Badge

A React badge component - toned status chips with a dot, icon or pill shape. One chip, one value: a label, a status or a count, animated whenever it changes.

Badge playground

Published
One chip, one value. Change it and the chip animates itself - digits roll, words re-letter in place. There is nothing to wire up.

Install Badge

1. New project? One command installs the package and wires everything - see Installation:

bash
pnpm dlx zyncat-ui init

2. Import the component - it loads its own stylesheet:

tsx
import { Badge } from '@zyncat/ui/badge';

Usage

tsx
import { Badge } from '@zyncat/ui/badge';
 
<Badge value="New Release" tone="info" pill />
<Badge value="Scheduled" tone="info" dot />
<Badge value={12} />

Compose Badge in your application. No Tailwind or external styling library is required; every value resolves from Zyncat UI's token vocabulary.

Badge props

Badge

PropTypeDefaultDescription
...htmlAttributesHTMLAttributes—Standard <span> attributes (aria-*, data-*, title, ...) forwarded to the chip.
value*string | number—The chip's content. Changing it animates in place.
animateBadgeAnimation'auto'How a `value` change animates: `roll` spins each digit, `morph` re-letters the word. `auto` rolls numbers and morphs text - name one to override a formatted figure like "1,024".
toneBadgeTone'neutral'Status hue.
variant'soft' | 'glass' | 'outline''soft'Surface: a flat toned fill, the frosted chip, or a hairline outline.
size'sm' | 'md''md'Chip density - `sm` is 20px for table rows and inline use.
glintboolean—Sweep a sheen across the chip when `value` changes - for a state that has landed.
dotboolean—Leading status dot.
liveboolean—Dot pulses (implies dot) - for in-progress status.
pillboolean—Fully-rounded shape.
iconReactNode—Optional leading <Icon> (overrides dot if both set).
classNamestring—Extra class(es) merged onto the chip.
styleCSSProperties—Inline styles merged onto the chip.

Frequently asked questions

tone sets the chip's color semantics - neutral, info, success, warning or danger - and defaults to neutral. Pair it with variant, size, dot, live, pill and icon to compose the chip; value is the content.

Pass a node to icon for a leading icon, or set dot for a plain status dot instead. live pulses that dot for an in-progress state and implies dot on its own - icon takes priority, so if both are set the dot is not rendered.

variant defaults to 'soft': a flat toned fill with no border, shadow or hover, so the chip reads as a label rather than a control. variant="glass" gives it the translucent, interactive glass surface, and variant="outline" a flat bordered chip.

pill switches the chip to a fully-rounded shape. size="sm" is a 20px chip against the default 24px - the same type and side padding, tightened vertically for table rows and inline use.

Put the status in value and pick the tone for it: <Badge value="Published" tone="success" dot />. There is no fixed status vocabulary - your states, your wording, your mapping - and changing value animates the chip into its new state.

It is the default. Change value and the old word slides out while the new one slides in, with the chip resizing to fit. Pass animate="none" if you want the label to replace itself on the next render instead.

Set glint. Every time value changes, a one-off sheen sweeps across the chip - render it conditionally, glint={status === 'published'}, to reserve the effect for the state that has landed.

Pass a number to value: <Badge value={12} />. A numeric value is set mono and tabular and rolls its digits on change, and every other Badge prop still applies. A pre-formatted figure is a string, so pair it with animate="roll" - <Badge value="7 / 10" animate="roll" />.

It is the default for a numeric value. Each digit is its own column that slides vertically to the new figure; non-digit characters such as a slash or a space stay fixed in place. Pass animate="none" for plain text.

A chip holding a figure renders in a monospace font with tabular figures, so every digit takes the same width and a count going from 9 to 10 doesn't jiggle the surrounding layout. Text values stay in the body font - the mono treatment is reserved for figures.

Set in Geist & Newsreader — animated by the house engineZyncat UI · Rev 0.11 · MIT · Built by Tabsir Ahammed · Source on GitHub