Badge
Round check or cross badge in accent, ink, or paper tones for fixed and broken states.
Install
npx shadcn@latest add @jbm/badgeNeeds the @jbm entry in components.json; see Install once.
Also installs @jbm/tokens, @jbm/paper.
Usage
import { Badge } from "@/jbm/ui/badge"<div style={{ display: "flex", gap: 40 }}> <Badge kind="check" size={100} /> <Badge kind="x" size={100} tone="ink" /></div>Props
- Stage px
- Declared at the documented defaults
- Landscape
44 by 44- Vertical
44 by 44- Basis
Square size × size box at the default size 44; the shadow extends below it.
Circle with the paper shadow and a stroked check or cross (55% of the size). Accent and ink fills draw a cream mark; paper draws an ink mark with a 2px ink outline. Static; animate it by wrapping or via style.
| Prop | Type | Default | Description |
|---|---|---|---|
kind | "check" | "x" | required | Mark to draw: check (fixed) or x (broken). |
size | number | 44 | Diameter in stage pixels. |
tone | PaperTone | "accent" | Fill: accent (vermilion, default), ink, or paper (cream with an ink outline). |
style | React.CSSProperties | none | Inline styles merged last; use for absolute placement, opacity, or transforms. |
QA checks
- Compare all three tones with both marks: the mark stays legible (cream on accent and ink, ink on paper).
- At small sizes the 4-unit stroke of the 24-unit icon scales down; check the check and cross remain readable around 24px.