Badge

Badges display additional metadata related to a resource they're nearby.

Subtle

Coming soon

Info

Recommended

Success

New

Warning

Warning

Error

Deprecated

Upsell

Upgrade

#

#

Use the subtle variant to display information in a neutral tone. This is the default variant.

#

Use the info variant to draw attention, but not lean positive or negative.

#

Use the success variant to display information in a positive or successful tone.

#

Use the warning variant to display information in an alerting tone.

#

Use the error variant to display negative or immediately concerning information.

#

Use the upsell variant to display information about billing plans or unlockable product features.

#

Text gets cut off by ellipses when the badge text gets long.

#

Displays inline.

#

When a badge is small, it has a smaller font size and a height of 20px.

#

#

Icons can be used in badges when additional clarity is required and the icon is highly relevant. Icons should not be used for decoration.

Icon colors can be overridden with the iconColor prop. Use this only when a different color is highly relevant.

Integration logos can be shown with the iconSrc prop.

#

If you are using a Badge as a button, use the BadgeButton component to pass through the appropriate HTML layout and accessibility features.

#

Close buttons and other actions can be shown with the rightAction prop.

#

Badge group is used to display multiple badges and collapse them to a single line, if necessary.

If truncated, use the same variant as size props on the BadgeGroup as it's children Badges. These styles will determine the appearance of the "more" button.

By default the badge group will render popover content in a portal. To disable this pass removePortal.

When badge group is not constrained by the parent container and has the ability to show all badges without truncation, pass truncate={false} to disable it.

#

#

Always position a badge immediately after the resource they're related to.

#

Prefer one or two words max.

#

#

Inherits margin props.

NameDefaultDescription
children

ReactNode

Badge text.

variant"subtle""subtle" | "info" | "success" | "warning" | "error" | "upsell"

Badge variant determines the purpose it is used for, and it's appearance.

size"md""sm" | "md"

Determines the size of the badge.

svgIcon

ComponentType<SVGAttributes<SVGElement>>

Badge icon that's displayed on the left. Can be either a component or an object with props to override defaults.

iconSrc

string

URL for an image icon.

iconColor

ColorProps["color"]

Override the default icon color.

rightActionProps

IconButtonProps & Record<`data-${string}`, string>

Right action configuration.

#

Root-level component for displaying groups of badges.

All Badge components must be children of BadgeGroup.

Inherits margin props.

NameDefaultDescription
truncatetrueboolean

Display as much badges as possible on a single row and show the rest in a popover.

removePortalfalseboolean

Determines if the popover content is rendered in a portal.

variant"subtle"BadgeProps["variant"]

Determines the appearance of the "more" button, if applicable. Use the same variant as the group's children badges.

size"md"BadgeProps["size"]

Determines the size of "more" button, if applicable. Use the same size as the group's children badges.

children

ReactNode

Badges.

On this page

  • Usage
  • Subtle
  • Info
  • Success
  • Warning
  • Error
  • Upsell
  • Long
  • With a neighbor
  • Small
  • Numbers
  • Icons
  • As Button
  • Actions
  • Groups
  • Guidelines
  • Placement
  • Content
  • Props
  • Badge
  • BadgeGroup