Split Button
Primary action fused to a dropdown of secondary actions.
Import
tsx
import { SplitButton } from "@cooud-ui/ui";
bash
npx cooud-ui add split-button
Examples
API Reference
Generated from the component's exported types.
SplitButtonProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "onClick">
| Prop | Type | Default | Description |
|---|---|---|---|
children* | ReactNode | — | The primary action's label. |
onClick | MouseEventHandler<HTMLButtonElement> | — | Fires when the primary (left) segment is clicked. |
icon | ReactNode | — | Optional leading icon for the primary segment (replaced by a spinner while `loading`). |
items | SplitButtonItem[] | — | Declarative secondary actions. Ignored when a custom `menu` slot is supplied. |
menu | ReactNode | — | Escape hatch for fully custom menu content (compose `DropdownMenuItem`, `DropdownMenuSeparator`, `DropdownMenuLabel`, …). Takes precedence over `items`. |
variant | SplitButtonVariant | "primary" | Visual style, shared by both segments — mirrors `Button`'s variants. |
size | SplitButtonSize | "md" | Control height/density, shared by both segments. |
disabled | boolean | false | Disables both segments. |
loading | boolean | false | Shows a spinner in the primary segment and disables the control. |
menuLabel | string | "More actions" | Accessible name for the icon-only menu trigger. |
align | "start" | "center" | "end" | "end" | Horizontal alignment of the menu relative to the trigger. |
sideOffset | number | 6 | Gap in px between the trigger and the opened menu. |
contentClassName | string | — | Class applied to the dropdown menu surface. |
defaultOpen | boolean | — | Uncontrolled initial open state of the menu. |
open | boolean | — | Controlled open state of the menu. |
onOpenChange | (open: boolean) => void | — | Notified whenever the menu opens or closes. |