Split Button
One main action with related ones a click away. The main side runs the most common choice; the menu holds the alternatives.
Install
npx shadcn@latest add @nelumbo/split-buttonVariants
Open a menu: the trigger rounds out into a full pill and the chevron turns over. Arrow keys move through the items; Escape closes the menu.
Last action: Nothing yet
Sizes
Usage
<SplitButton variant="secondary"> <SplitButtonAction onClick={save}>Save</SplitButtonAction> <SplitButtonMenu label="More save options"> <SplitButtonItem icon="save_as" onSelect={saveAs}>Save as</SplitButtonItem> </SplitButtonMenu></SplitButton>Props
| Prop | Type | Default | Notes |
|---|---|---|---|
variant | "default" | "secondary" | "elevated" | "outline" | "destructive" | "default" | Applies to both halves |
size | "xs" | "sm" | "default" | "lg" | "xl" | "default" | |
Menu: label | string | required | Accessible name of the trigger |
Menu: align | "start" | "end" | "end" | |
Menu: open / onOpenChange | Control the menu | ||
Item: icon | IconName | ||
Item: onSelect | (event) => void | Radix DropdownMenu item |