Components
Badge
Compact status, count, and tag labels with variants, sizes, icons, and actions.
Badge labels status, metadata, and counts. It is decorative by default and renders a span. For
removable or clickable chips, use Tag.
Live preview#
DefaultInfoSuccessWarningDestructiveOutline
import { Badge, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} wrap>
<Badge>Default</Badge>
<Badge variant="info">Info</Badge>
<Badge variant="success">Success</Badge>
<Badge variant="warning">Warning</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
</Stack>
);
}Sizes#
SmallMediumLarge
import { Badge, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<Badge size="sm">Small</Badge>
<Badge size="md">Medium</Badge>
<Badge size="lg">Large</Badge>
</Stack>
);
}Shapes#
RoundedPill
import { Badge, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} wrap>
<Badge shape="rounded">Rounded</Badge>
<Badge shape="pill">Pill</Badge>
</Stack>
);
}Icons and dots#
Icons are decorative. A leading dot inherits the variant accent color. With no content, dot
renders a standalone status dot; give it an aria-label when the status is meaningful.
InfoDoneOnline
import { Badge, Stack } from '@orkest/ui';
import { Check, Circle } from 'lucide-react';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<Badge variant="info" leftIcon={Circle}>
Info
</Badge>
<Badge variant="success" rightIcon={Check}>
Done
</Badge>
<Badge variant="success" dot>
Online
</Badge>
<Badge variant="success" dot aria-label="Online" />
</Stack>
);
}Count#
count takes precedence over children. Values above maxCount render as maxCount+.
899+
import { Badge, Stack } from '@orkest/ui';
export function Example() {
return (
<Stack direction="row" gap={2} align="center" wrap>
<Badge count={8} variant="destructive" shape="pill" />
<Badge count={120} maxCount={99} variant="info" shape="pill" />
</Stack>
);
}Custom color#
color creates a tinted badge while keeping the theme surface underneath. Check text contrast when
using light or low-contrast colors.
Custom
import { Badge } from '@orkest/ui';
export function Example() {
return <Badge color="#7c3aed">Custom</Badge>;
}Props#
| Prop | Type | Default |
|---|---|---|
variant | 'default' | 'info' | 'success' | 'warning' | 'destructive' | 'outline' | 'default' |
| Semantic color treatment. | ||
size | 'sm' | 'md' | 'lg' | 'md' |
| Control height, font size, radius, and icon size. | ||
shape | 'rounded' | 'pill' | 'rounded' |
| Corner treatment. | ||
leftIcon | LucideIcon | — |
| Decorative icon rendered before the content. | ||
rightIcon | LucideIcon | — |
| Decorative icon rendered after the content. | ||
dot | boolean | false |
| Shows a leading status dot. With no content, renders a standalone dot and should receive an aria-label when meaningful. | ||
count | number | — |
| Count value. Takes precedence over children. | ||
maxCount | number | 99 |
| Maximum displayed count before rendering `maxCount+`. | ||
color | string | — |
| Custom CSS color used as a tinted badge accent. | ||
native attributes | HTMLAttributes<HTMLSpanElement> | — |
| ARIA attributes, event handlers, className, style, and ref are forwarded. | ||
Accessibility#
- Badges render a
spanand are not interactive. Use Tag for removable or clickable chips. - A standalone dot needs an
aria-labelwhen its status is meaningful. - Icons are decorative and hidden from assistive technology.
- Do not communicate status with color alone. Pair variants and custom colors with text or a dot label.
- Check contrast when using custom colors.