Badge
since v0.1.0Compact status label — pill-shaped, mono uppercase, optional colored dot for state.
Set interactive to render an in-place pill toggle (role="button", keyboard
activation). For navigation or affordance-heavy use cases prefer wrapping a
non-interactive Badge inside a real <button> or <a> so the semantic
element does the lifting.
Forwards ref to the root <span>.
Install
Add the package and import the component.
pnpm add @hey-mike/tungstenpnpm add @hey-mike/tungstenimport { Badge } from '@hey-mike/tungsten';import { Badge } from '@hey-mike/tungsten';Preview
Same fixtures used by the visual-regression suite.
Usage
apps/docs/app/snapshots/badge/page.tsx
import { Badge } from '@hey-mike/tungsten';
import { VariantGrid } from '../_components/VariantGrid';
export default function BadgeSnapshot() {
return (
<VariantGrid
title="Badge"
variants={[
{ label: 'default', node: <Badge>Default</Badge> },
{ label: 'brand', node: <Badge variant="brand">Brand</Badge> },
{ label: 'success', node: <Badge variant="success">Success</Badge> },
{ label: 'warning', node: <Badge variant="warning">Warning</Badge> },
{ label: 'error', node: <Badge variant="error">Error</Badge> },
{ label: 'info', node: <Badge variant="info">Info</Badge> },
]}
/>
);
}
import { Badge } from '@hey-mike/tungsten';
import { VariantGrid } from '../_components/VariantGrid';
export default function BadgeSnapshot() {
return (
<VariantGrid
title="Badge"
variants={[
{ label: 'default', node: <Badge>Default</Badge> },
{ label: 'brand', node: <Badge variant="brand">Brand</Badge> },
{ label: 'success', node: <Badge variant="success">Success</Badge> },
{ label: 'warning', node: <Badge variant="warning">Warning</Badge> },
{ label: 'error', node: <Badge variant="error">Error</Badge> },
{ label: 'info', node: <Badge variant="info">Info</Badge> },
]}
/>
);
}
Props
Surface specific to <Badge />.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "brand" | "success" | "warning" | "error" | "info" | default | — |
| emphasis | "subtle" | "strong" | — | — |
| numericValue | ReactNode | — | Renders a nested numeric pill (split-pill layout, subtle emphasis only). |
| icon | ReactElement<unknown, string | JSXElementConstructor<any>> | — | Optional leading icon. Replaces the status dot when provided. |
| interactive | boolean | false | — |
| disabled | boolean | false | — |
Used in recipes
Compositions from the /recipes reference that use this component.
- →
Report card v2
Alternate /results layout — sticky 380px radar hero on the left, 4-col dimension breakdown grid (label, sparkline, score, verdict) on the right. All seven dimensions fit in a single fold on viewports ≥ 1024px.
- →
Row card
Interactive list row used on /problems and similar list views. Hover lifts -2px and reveals a faint gradient-mask border in the brand hue. Header carries level + topic + tag badges with a meta line and trailing action button.
- →
Score card
A compact card showing one dimension with its score, threshold tier, and most-recent-assessment timestamp. The smallest unit of a results grid.