SplitButton
A Split Button combines a primary action with a dropdown menu of related actions. It allows users to quickly perform the main action while providing access to additional options without taking up extra space.
Usage
<SplitButton
variant="primary"
size="md"
menuLabel="Flere handlinger"
onClick={() => {}}
items={items}
>
Lagre
</SplitButton>
Variants
SplitButton has two variants. There is no flat.
<SplitButton variant="primary" menuLabel="Flere handlinger" onClick={() => {}} items={items}>
Lagre
</SplitButton>
<SplitButton variant="secondary" menuLabel="Flere handlinger" onClick={() => {}} items={items}>
Lagre
</SplitButton>
| Variant | Use it for |
|---|---|
primary | The one action the view exists for. One per view. |
secondary | The alternative beside a primary. |
Props
SplitButton has its own API, not Mantine's — every prop is listed here.
| Property | Type | Allowed values | Default | Description |
|---|---|---|---|---|
children* | ReactNode | — | — | Label of the primary (left) action. |
icon | ReactNode | — | — | Icon shown before the label of the primary action. |
onClick* | () => void | — | — | Handler for the primary action. |
items* | SplitButtonItem[] | — | — | Dropdown entries — { key, label, onClick, disabled?, icon? }, each rendered as a Menu.Item. label is visible text, not just a name, and icon renders before it. |
menuLabel* | string | — | — | Accessible name for the dropdown trigger, wired straight to that button's aria-label — see Accessibility below. |
variant | SplitButtonVariant | primary · secondary | primary | Controls the visual treatment of both halves. |
size | SplitButtonSize | sm · md · lg | md | Sets the height of both halves — 32px, 40px or 48px, the same scale as Button. |
disabled | boolean | — | false | Disables both halves. |
classNames / styles / vars / unstyled | Styles API | action · trigger · dropdown · item | — | Targets the primary half, the caret half, and the dropdown and its items. SplitButton owns no wrapper element, so there is no root — className/style are not accepted. |
* Required
The primary half has a minimum width of 88px, narrower than a standalone
Button. The trigger is square, as tall as the current size. Menu rows are at
least 40px tall, and hovered and keyboard-selected rows use the same surface.
Accessibility
menuLabel is the accessible name of the caret-only trigger. When several
split buttons share a page, make it name what the menu belongs to — for
example Flere handlinger for ${rad.navn} instead of a bare
"Flere handlinger".
disabled on SplitButton disables both halves; an item's own disabled
greys out only that row. Neither explains why — say so in text near the
control.
Focus behaviour, the disabled state and the thresholds themselves are theme-wide: see Accessibility.