Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

SplitButton

  • 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";
Loading example…
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.

Loading…
label
variant
size
isDisabled
defaultOpen
Generated code
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.

Loading example…

Disabled

Figma State=Disabled (isDisabled): both parts are disabled and the whole control fades to 45 %.

Loading example…

Long label

The label wraps instead of truncating; the chevron stretches to the action's height.

Loading example…

Props 15

Press "Try it" on a card to load that prop into the playground.

15 props shown

label*Nexera
ReactNode

Label of the main action. Use a verb that names the outcome ("Export"); it wraps, never truncates.

Default –
iconNexera
ReactNode

Icon before the label. Decorative: the label names the action.

Default –
variantNexera
"primary" | "secondary"

Visual emphasis.

Default "primary"
sizeNexera
"sm" | "md"

Height and padding: 32 or 40 px on web; the control tokens raise them on iOS and Android.

Default "md"
isDisabledNexera
boolean

Disables both the action and the menu trigger. Disabled buttons leave the tab order; tell people nearby why the action is unavailable.

Default false
onPressNexera
(event: PressEvent) => void

Called when the main action is pressed (click, tap, Enter or Space).

Default –
menuTriggerLabelNexera
string

Accessible 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").

Default "More options"
children*Nexera
ReactNode | ((item: T) => ReactNode)

The alternative actions: MenuItem, MenuSection and MenuDivider parts, or a function of items.

Default –
itemsNexera
Iterable<T>

Items for a dynamic menu; children is then a function that renders one item.

Default –
onActionNexera
(key: Key) => void

Called with the item's id when a menu item is activated.

Default –
disabledKeysNexera
Iterable<Key>

Keys of menu items that are disabled.

Default –
isOpenNexera
boolean

Whether the menu is open. Use with onOpenChange.

Default –
defaultOpenNexera
boolean

Whether the menu is open on first render (uncontrolled).

Default false
onOpenChangeNexera
(isOpen: boolean) => void

Called when the menu opens or closes.

Default –
classNameNexera
string

Extra classes for the root, merged last so they win over the defaults.

Default –

* 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.

0 px · drag the corner

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-disabled
  • data-focus-visible
  • data-hovered
  • data-pressed
Usage
<SplitButton className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components