Chip
A small tinted label with an icon, in eight tones and four sizes: a status, a type, an app, or a filter you press.
npx shadcn@latest add @silicon-ui/chipInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/chipManually
Copy these files into your project
- components/silicon-ui/chip/chip.tsx
- components/silicon-ui/chip/chip.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
Chip
| Prop | Type | Default |
|---|---|---|
children*The words. | ReactNode | — |
sizeHeight in px. Defaults to 24. | ChipSize
| — |
toneDefaults to neutral. | ChipTone
| — |
variantDefaults to tint. | ChipVariant
| — |
shapeDefaults to soft. | ChipShape
| — |
iconAn icon at the start, sized by the chip (12 to 18px). Its colour is the tone. Duotone icons look as designed: a back layer drawn with an `opacity` attribute (Phosphor's duotone weight) shows at 40%. | ReactNode | — |
iconOnlyShows the icon alone in a square; the words stay as the chip's name for screen readers and its tooltip. | boolean | — |
shrinkLets the chip shrink in a row that is too narrow; its words end in "…". | boolean | — |
Also accepts the props of HTMLAttributes.
ChipButton
| Prop | Type | Default |
|---|---|---|
children*The words. | ReactNode | — |
sizeHeight in px. Defaults to 24. | ChipSize
| — |
toneDefaults to neutral. | ChipTone
| — |
variantDefaults to tint. | ChipVariant
| — |
shapeDefaults to soft. | ChipShape
| — |
iconAn icon at the start, sized by the chip (12 to 18px). Its colour is the tone. Duotone icons look as designed: a back layer drawn with an `opacity` attribute (Phosphor's duotone weight) shows at 40%. | ReactNode | — |
iconOnlyShows the icon alone in a square; the words stay as the chip's name for screen readers and its tooltip. | boolean | — |
shrinkLets the chip shrink in a row that is too narrow; its words end in "…". | boolean | — |
Also accepts the props of ButtonHTMLAttributes.
Dependencies
- npm
- None
- Registry
- silicon-motion-tokens