Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

Badge

Badges are used to highlight an item's status for quick recognition.

Import

Usage

Basic badge

To display the badge on the top-right corner of the wrapped component, specify the badgeContent prop with the desired content.

EDITABLE EXAMPLE

Dot badge

Use variant="dot" to change a badge into a small dot. This can be used as a notification that something has changed without giving a count.

EDITABLE EXAMPLE

Standalone badge

The badge can be used as a standalone component. This can be useful for displaying a badge without a surrounding element.

EDITABLE EXAMPLE

Badge alignment

You can use the placement prop to move the badge to any corner of the wrapped element. The default placement is top-right. The placement prop can be one of top-left, top-right, bottom-left, bottom-right.

EDITABLE EXAMPLE

Badge visibility

The badge visibility can be controlled using the isInvisible prop.

EDITABLE EXAMPLE

Color

The color of the badge can be changed by passing the backgroundColor prop. See the colors section to learn more about colors.

EDITABLE EXAMPLE

Size

The size of the badge can be changed by passing the height and minWidth props.

EDITABLE EXAMPLE

Customization

You can customize the badge style by passing style props. See the following example to learn how to create a outline badge.

EDITABLE EXAMPLE

Props

NameTypeDefaultDescription
badgeContentnode | number | stringThe badge content.
isInvisiblebooleanWhether the badge is invisible.
placementstring'top-right'The placement of the badge. One of: 'top-left', 'top-right', 'bottom-left', 'bottom-right'.
variantstring'solid'One of: 'solid', 'dot'