Skip to main content

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.

Base
Wrapper over Mantine
Import
{ SplitButton } from '@multiconsult-group-products/design-system'
Source
src/components/SplitButton/SplitButton.tsx
src/components/SplitButton/SplitButton.module.css

Usage​

variant
size
sm
md
lg
disabled
icon
React
<SplitButton
variant="primary"
size="md"
menuLabel="Flere handlinger"
onClick={() => {}}
items={items}
>
Lagre
</SplitButton>

Variants​

SplitButton has two variants. There is no flat.

React
<SplitButton variant="primary" menuLabel="Flere handlinger" onClick={() => {}} items={items}>
Lagre
</SplitButton>
<SplitButton variant="secondary" menuLabel="Flere handlinger" onClick={() => {}} items={items}>
Lagre
</SplitButton>
VariantUse it for
primaryThe one action the view exists for. One per view.
secondaryThe alternative beside a primary.

Props​

SplitButton has its own API, not Mantine's — every prop is listed here.

PropertyTypeAllowed valuesDefaultDescription
children*ReactNode——Label of the primary (left) action.
iconReactNode——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.
variantSplitButtonVariantprimary · secondaryprimaryControls the visual treatment of both halves.
sizeSplitButtonSizesm · md · lgmdSets the height of both halves — 32px, 40px or 48px, the same scale as Button.
disabledboolean—falseDisables both halves.
classNames / styles / vars / unstyledStyles APIaction · 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.