Split Button
- Needs review
- WCAG 2.2 evidence
- RTL
A main action with a menu of related alternatives: a button plus a chevron button that opens
a Menu. Both parts are native buttons built on React Aria, with their own names, keyboard access (Tab, Enter, Space;
the chevron also opens with the arrow keys) and focus rings (WCAG 2.1.1, 2.4.7, 4.1.2); the chevron has
aria-haspopup and aria-expanded. Use it when one action is clearly the default; when the alternatives matter as
much, use separate buttons or a Menu.
import { SplitButton } from "@nexera-ui/react";- 4
- examples
- 15
- props
- 5
- live controls
- 1
- platform
- 10
- WCAG criteria
- 1
- block uses it
Try every prop. Copy the code.
Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.
import { SplitButton } from "@nexera-ui/react";
<SplitButton />Examples 3
The same examples as Storybook, rendered live. Open Code to copy one.
Variants and sizes
Every Figma Variant and Size.
import { SplitButton } from "@nexera-ui/react";
import { LuDownload } from "react-icons/lu";
const variants = ["primary", "secondary"] as const;
const sizes = ["sm", "md"] as const;
export function VariantsAndSizes() {
return (
<div className="flex flex-col gap-4">
{variants.map((variant) => (
<div key={variant} className="flex flex-wrap items-center gap-4">
{sizes.map((size) => (
<SplitButton
key={size}
label="Export"
icon={<LuDownload />}
variant={variant}
size={size}
menuTriggerLabel={`More ${variant} ${size} options`}
/>
))}
</div>
))}
</div>
);
}
Disabled
Figma State=Disabled (isDisabled): both parts are disabled and the whole control fades to 45 %.
import { MenuItem, SplitButton } from "@nexera-ui/react";
import { LuDownload, LuFileText, LuTable } from "react-icons/lu";
function ExportItems() {
return (
<>
<MenuItem id="pdf" label="Export as PDF" icon={<LuFileText />} />
<MenuItem id="xlsx" label="Export as Excel" icon={<LuTable />} />
<MenuItem id="csv" label="Export as CSV" />
</>
);
}
<SplitButton label="Export" icon={<LuDownload />} menuTriggerLabel="More export options" isDisabled>
{<ExportItems />}
</SplitButton>;
Long label
The label wraps instead of truncating; the chevron stretches to the action's height.
import { SplitButton } from "@nexera-ui/react";
import { LuDownload } from "react-icons/lu";
export function LongLabel() {
return (
<div className="max-w-60">
<SplitButton
icon={<LuDownload />}
menuTriggerLabel="More export options"
label="Export the whole quarter including archived projects"
/>
</div>
);
}
Props 15
Press "Try it" on a card to load that prop into the playground.
15 props shown
label*NexeraReactNodeLabel of the main action. Use a verb that names the outcome ("Export"); it wraps, never truncates.
iconNexeraReactNodeIcon before the label. Decorative: the label names the action.
variantNexera"primary" | "secondary"Visual emphasis.
sizeNexera"sm" | "md"Height and padding: 32 or 40 px on web; the control tokens raise them on iOS and Android.
isDisabledNexerabooleanDisables both the action and the menu trigger. Disabled buttons leave the tab order; tell people nearby why the action is unavailable.
onPressNexera(event: PressEvent) => voidCalled when the main action is pressed (click, tap, Enter or Space).
menuTriggerLabelNexerastringAccessible name of the chevron button that opens the menu (it has no visible text). Translate it for your locale, and make it specific when several split buttons share a page ("More export options").
children*NexeraReactNode | ((item: T) => ReactNode)The alternative actions: MenuItem, MenuSection and MenuDivider parts, or a function of items.
itemsNexeraIterable<T>Items for a dynamic menu; children is then a function that renders one item.
onActionNexera(key: Key) => voidCalled with the item's id when a menu item is activated.
disabledKeysNexeraIterable<Key>Keys of menu items that are disabled.
isOpenNexerabooleanWhether the menu is open. Use with onOpenChange.
defaultOpenNexerabooleanWhether the menu is open on first render (uncontrolled).
onOpenChangeNexera(isOpen: boolean) => voidCalled when the menu opens or closes.
classNameNexerastringExtra classes for the root, merged last so they win over the defaults.
* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.
Accessible by default.
Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.
WCAG 2.2 evidence
5 direct · 5 supporting- 1.3.1Info and RelationshipsLevel A · tested directly
- 1.4.4Resize TextLevel AA · supporting test
- 1.4.11Non-text ContrastLevel AA · supporting test
- 1.4.12Text SpacingLevel AA · supporting test
- 2.1.1KeyboardLevel A · tested directly
- 2.4.3Focus OrderLevel A · tested directly
- 2.4.7Focus VisibleLevel AA · tested directly
- 2.4.11Focus Not Obscured (Minimum)Level AA · supporting test
- 2.5.8Target Size (Minimum)Level AA · supporting test
- 4.1.2Name, Role, ValueLevel A · tested directly
Fits any width.
Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.
Styling hooks
Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.
data-disableddata-focus-visibledata-hovereddata-pressed
<SplitButton className="data-disabled:opacity-90 shadow-sm" />Used in blocks
Related components
- BoardCardA Kanban card: avatar, name, role, drag handle and a detail line.
- ButtonTriggers an action such as Save, Submit, Approve or Delete.
- ButtonGroupItemOne toggle in a joined row of buttons, for example a List / Grid view switch or a set of filters.
- ContextMenuThe menu of actions for an element, opened where the user asks for it: right-click, long-press on touch screens, and from the keyboard with Shift+F10 or the ContextMenu key (the browser reports both as a `contextmenu` event on the focused element; on macOS, Control+Enter).
- DragHandleGrip that starts a drag of the collection item it sits in.
- DropIndicatorInsertion line shown between two items while something is dragged over a `GridList` or `ListBox`.
- IconButtonA square, icon-only button for compact actions such as Settings, Close or Delete row.
- MenuA list of actions or options that opens from a trigger.