Button
A clear, responsive action with quiet secondary states.
npx shadcn@latest add @silicon-ui/buttonInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/buttonManually
Install the dependencies
npm install motionCopy these files into your project
- components/silicon-ui/button/button.tsx
- components/silicon-ui/button/button.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 |
|---|---|---|
variantThe look: `primary` (default) for the main action, `secondary` bordered, `ghost` quiet, `danger` destructive, `soft` filled for bars, `link` underlined text. | ButtonVariant
| "primary" |
sizeHeight: `xs` 24px, `sm` 36px, `md` 44px (default), `lg` 50px. | ButtonSize
| "md" |
loadingShows a spinner in place of the label and sets aria-busy, keeping the button's width. | boolean | false |
mutedA quieter label for `soft` and `secondary` (experimental): it rests in secondary text and turns full strength on hover, press and keyboard focus, like `ghost` already does. Size, weight, fill and the disabled look are unchanged; icons follow the label's colour. For a bar of actions beside text, where a full-strength label would outweigh it. | boolean | false |
shapeThe corners (experimental): `soft` (default) has the control radius, as Chip's `soft` does; `pill` is fully round, a pill with words and a circle when the button is icon-only, at every size and variant. For a round action beside other round controls (Replay and Full screen beside a stage's switches). | ButtonShape
| "soft" |
Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, except onDrag, onDragEnd, onDragStart, onAnimationStart.
Dependencies
- npm
- motion
- Registry
- silicon-motion-tokens