‮Skip to content‬
uiify

Badge

‮Short label for a state, category, or count.‬

‮Browsers‬
Chrome 123+Firefox 121+Safari 17.5+
‮Tier‬
0
‮Bundle compressed‬
201 B
‮Forced layout budget‬
0 ms
‮Axe budget‬
0
‮SSR compatible‬
‮Yes‬
‮Published contract‬
‮Test harness‬

‮Playground‬

Badge

Ready

‮Examples‬

Status labels

Use visible words to convey state; color is a supporting cue.

DraftReadyReviewBlocked
import { Badge } from "@gunkin/uiify";

export default function Example() {
  return (
    <>
      <Badge variant="secondary">Draft</Badge>
      <Badge variant="success">Ready</Badge>
      <Badge variant="warning">Review</Badge>
      <Badge variant="destructive">Blocked</Badge>
    </>
  );
}

‮API‬

Badge

‮Prop‬‮Type‬‮Default‬‮Description‬
childrenReactNode—‮Text shown inside the badge.‬
variant"secondary" | "success" | "warning" | "destructive"—‮Visual meaning written to data-variant; keep status understandable in text.‬
size"sm" | "md" | "lg"—‮Visual scale written to data-size; omitted when unset.‬
asElementType"span"‮Native element or component used for the root.‬
classNamestring—‮Class applied to the root element.‬
styleCSSProperties—‮Native root styles.‬
refRef<HTMLElement>—‮Ref forwarded to the rendered root element.‬
renderReactElement | ((props, state) => ReactElement)—‮Replace the rendered element while keeping behavior and accessibility wiring.‬

‮Keyboard‬

‮Key‬‮Action‬

‮Accessibility‬

‮Static text marker with no role or keyboard behavior. Keep its meaning in visible words and do not use it as a control.‬

‮Styling hooks‬

data-uiify-badgedata-variantdata-size