114
A primary action with a menu of alternatives beside it: pick one and it runs, then takes the primary slot, its label springing to the new width.
akasplit button·dropdown button·button group
Run this in any project set up for the shadcn CLI. It copies the Split Button source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/split-button.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { SplitButton } from "@/components/split-button";
export default function Page() {
return <SplitButton />;
}A free React component in the Workspace collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Split Button source. Everything is optional unless it says required.
| Prop | Type | Default |
|---|---|---|
| actionsrequired | SplitAction[] | — |
| defaultActionId | string | — |
| onAction | (action: SplitAction) => void | Promise<unknown> | — |
| remember | boolean | true |
| menuLabel | string | "Choose an action" |
| variant | "default" | "outline" | "default" |
| disabled | boolean | — |
| className | string | — |