Split Button
Server ComponentPrimary action fused to a dropdown of secondary actions.
Import
import { SplitButton } from "@cronus-ui/ui";
npx cronus-ui add split-button
Examples
.cronus
The same component declared in Cronus. Emitted at build time from the audit fixtures — the kernel renders it as HTML with no React.
default.cronus
app "audit-fixtures" {
port 5176
}
style {
preset aurora
theme dark
}
component SplitButtonDefault layout:inline style:split-button {
aria-label:"Save actions"
label "Save"
text "Duplicate"
text "Archive"
}
page "/audit/split-button/default" type:custom {
use SplitButtonDefault
}
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. |
className | string | — | Additional class names merged onto the root. |
id | string | — | DOM id of the root element. |