Split button

A primary action with a menu of nearby alternatives.

npx shadcn@latest add @silicon-ui/split-button
actionmenu
Loading…

Installation

With the shadcn CLI

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

Manually

  1. Install the dependencies.

    npm install @radix-ui/react-dropdown-menu lucide-react motion
  2. Copy these files into your project. Shared files are skipped if you already have them.

    • components/silicon-ui/split-button/split-button.tsx
    • components/silicon-ui/split-button/split-button.module.css
    • components/silicon-ui/lib/menu-highlight.tsx shared
    • components/silicon-ui/text-morph/text-morph.tsx shared
    • components/silicon-ui/text-morph/text-morph.module.css shared
  3. Install the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

Source codetsx
import { SplitButton } from "@/components/silicon-ui/split-button/split-button";

API reference

PropTypeDefault
label*string—
actions*SplitButtonAction[]—
onClick() => void—
disabledboolean—
iconReactNode—
variant"primary" | "secondary""primary"

Dependencies

npm
@radix-ui/react-dropdown-menulucide-reactmotion
Registry
silicon-motion-tokenstext-morph