Badge
A small label for status, category, or metadata.
npx shadcn@latest add @silicon-ui/badgeInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/badgeManually
Install the dependencies
npm install motionCopy these files into your project
- components/silicon-ui/badge/badge.tsx
- components/silicon-ui/badge/badge.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
toneDefaults to neutral. | BadgeTone
| "neutral" |
sizeDefaults to md (24px). | BadgeSize
| "md" |
iconAn icon at the start, sized by the badge and coloured by its tone. | ReactNode | — |
Also accepts the props of HTMLAttributes<HTMLSpanElement>.
Dependencies
- npm
- motion
- Registry
- silicon-motion-tokens