Skip to content

Button

A clear, responsive action with quiet secondary states.

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

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/button

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/button/button.tsx
    • components/silicon-ui/button/button.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 { Button } from "@/components/silicon-ui/button/button";

API reference

PropTypeDefault
variant

The look: `primary` (default) for the main action, `secondary` bordered, `ghost` quiet, `danger` destructive, `soft` filled for bars, `link` underlined text.

ButtonVariant

"primary""secondary""ghost""danger""soft""link"

"primary"
size

Height: `xs` 24px, `sm` 36px, `md` 44px (default), `lg` 50px.

ButtonSize

"xs""sm""md""lg"

"md"
loading

Shows a spinner in place of the label and sets aria-busy, keeping the button's width.

booleanfalse
muted

A 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.

booleanfalse
shape

The 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""pill"

"soft"

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

Dependencies

npm
motion
Registry
silicon-motion-tokens