Action button
A compact button for frequent toolbar actions.
npx shadcn@latest add @silicon-ui/action-buttonInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/action-buttonManually
Install the dependencies
npm install lucide-react motionCopy these files into your project
- components/silicon-ui/action-button/action-button.tsx
- components/silicon-ui/action-button/action-button.module.css
Shared with other components. Skip any you already have.
- components/silicon-ui/text-morph/text-morph.tsx
- components/silicon-ui/text-morph/text-morph.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 |
|---|---|---|
label* | string | — |
onAction* | () => void | Promise<void> | — |
successLabel | string | "Saved" |
pendingLabel | string | "Saving" |
resetAfterMs | number | 2400 |
onActionError | (error: unknown) => void | — |
Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, except onClick, onDrag, onDragEnd, onDragStart, onAnimationStart.