Components / Core
Badge
Small label, e.g. "Reward ready".
import { Badge } from "@stylhero/ui";
Example
Code
import { Badge, Stack } from "@stylhero/ui";
function BadgeExample() {
return (
<Stack direction="row" gap={2} wrap>
<Badge>Draft</Badge>
<Badge tone="primary">New</Badge>
<Badge tone="success">Paid</Badge>
<Badge tone="warning">Low stock</Badge>
<Badge tone="danger">Overdue</Badge>
</Stack>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tone |
"neutral" | "primary" | "info" | "accent" | "warning" | "success" | "danger" |
"neutral" |
"warning" has the accent look but says what it means (pairs with Alert tone="warning"). |
Also takes every <span> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.
Accessibility
- Plain text, so its words carry the meaning: the tone color is only a hint.
Generated from src/components/Badge.tsx. Something wrong or missing? Open an issue.