Skip to content

Action button

A compact button for frequent toolbar actions.

ActionToolbar
npx shadcn@latest add @silicon-ui/action-button

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/action-button

Manually

  1. Install the dependencies

    npm install lucide-react motion
  2. Copy 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
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { ActionButton } from "@/components/silicon-ui/action-button/action-button";

API reference

PropTypeDefault
label*string—
onAction*() => void | Promise<void>—
successLabelstring"Saved"
pendingLabelstring"Saving"
resetAfterMsnumber2400
onActionError(error: unknown) => void—

Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, except onClick, onDrag, onDragEnd, onDragStart, onAnimationStart.

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokenstext-morph