Toali.connors@example.com
Brunch this weekend?
Hi Ali, are you free on Sunday? There’s a new place by the lake that I’d like to try, and they take bookings until Friday.
A split button is two buttons side by side: a leading button for an action, and a trailing button that opens a menu of options related to that action.
Use one for an action that has a set of related options. For an action alone, use a button, and to group several related actions, a button group.
A split button is composed of these parts:
| Part | Use |
|---|---|
SplitButtonLeading | The leading button, for the action |
SplitButtonTrailing | The trailing button, for the menu icon. Wrap it in a MenuTrigger to open a menu. |
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'Basic split button
Put a SplitButtonLeading and then a SplitButtonTrailing in a SplitButton.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Basic() {
return (
<SplitButton variant="tonal" size="m">
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Set variant and size on the SplitButton. Each button takes its own props, such as onPress and isDisabled.
The SplitButton comes in four variants. Set variant on the SplitButton to elevated, filled (the default), tonal or outlined. They are the same as a button's, without text.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
const variants = ['elevated', 'filled', 'tonal', 'outlined'] as const
export default function Variants() {
return (
<>
{variants.map((variant) => (
<SplitButton key={variant} variant={variant}>
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label={`More reply options, ${variant}`} />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
))}
</>
)
}Disable each button with its own isDisabled. A disabled button cannot be pressed or focused.
import { SplitButton, SplitButtonLeading, SplitButtonTrailing } from '@material-web/react'
export default function Disabled() {
return (
<>
<SplitButton>
<SplitButtonLeading isDisabled>Reply</SplitButtonLeading>
<SplitButtonTrailing aria-label="More reply options" isDisabled />
</SplitButton>
<SplitButton variant="outlined">
<SplitButtonLeading isDisabled>Reply</SplitButtonLeading>
<SplitButtonTrailing aria-label="More reply options" isDisabled />
</SplitButton>
</>
)
}Elevated split button
An elevated split button is a tonal one with a shadow. To avoid overusing shadows, use it only when the button needs visual separation from a visually prominent background.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Elevated() {
return (
<SplitButton variant="elevated">
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Filled split button
A filled split button has the most visual impact of the four. Use it for an important, final action that completes a flow.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Filled() {
return (
<SplitButton variant="filled">
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Tonal split button
A tonal split button suits a lower-priority action that needs slightly more emphasis than an outline gives.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Tonal() {
return (
<SplitButton variant="tonal">
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Outlined split button
An outlined split button is for medium-emphasis actions: ones that are important, but are not the primary action in a product.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Outlined() {
return (
<SplitButton variant="outlined">
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Icons
Write an icon as a child of the leading button, before or after its label. An Icon is sized to the button. Any icon works: Icon, an icon from an SVG library, or your own component. Give an icon that is not an Icon the size listed under Sizes. See Composition.
The leading button can hold an icon alone. It then has no visible text, so set an aria-label.
import {
Icon,
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function WithIcon() {
return (
<>
<SplitButton variant="tonal">
<SplitButtonLeading>
<Icon name="reply" />
Reply
</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
<SplitButton variant="tonal">
<SplitButtonLeading aria-label="Edit">
<Icon name="edit" />
</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More edit options" />
<MenuPopover>
<Menu>
<MenuItem>Rename</MenuItem>
<MenuItem>Duplicate</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
</>
)
}The trailing button has its own icon and takes no children.
Trailing button
In a MenuTrigger, the trailing button gets its onPress, aria-haspopup, aria-expanded and aria-controls from the trigger. While the menu is open, its icon turns 180° and its inner corner becomes round.
To open anything other than a menu, set those four props yourself. aria-expanded is what turns the icon and rounds the inner corner.
Exports as PDF, at the size of the page.
import { SplitButton, SplitButtonLeading, SplitButtonTrailing } from '@material-web/react'
import { useId, useState } from 'react'
export default function Expanded() {
const [isOpen, setOpen] = useState(false)
const panelId = useId()
return (
<div className="flex flex-col items-center gap-space-200">
<SplitButton variant="outlined">
<SplitButtonLeading>Export</SplitButtonLeading>
<SplitButtonTrailing
aria-label="More export options"
aria-expanded={isOpen}
aria-controls={panelId}
onPress={() => setOpen(!isOpen)}
/>
</SplitButton>
<p id={panelId} hidden={!isOpen} className="m-0 text-body-md text-on-surface-variant">
Exports as PDF, at the size of the page.
</p>
</div>
)
}Handling presses
Handle a press on the leading button with its onPress. In a MenuTrigger, a press on the trailing button opens the menu: handle a press on an item with onAction on the Menu, which is called with the item's id.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { useState } from 'react'
import { MenuTrigger } from 'react-aria-components'
export default function Press() {
const [action, setAction] = useState<string>()
return (
<>
<SplitButton>
<SplitButtonLeading onPress={() => setAction('reply')}>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More reply options" />
<MenuPopover>
<Menu onAction={(id) => setAction(String(id))}>
<MenuItem id="reply-all">Reply all</MenuItem>
<MenuItem id="forward">Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
<span className="text-body-md text-on-surface-variant">
{action ? `Last action: ${action}` : 'No action yet'}
</span>
</>
)
}Each button takes the same press events as a Button. See Handling presses.
Loading
Set isPending on the SplitButtonLeading while its action is in progress, as on a button. A pending leading button shows a loading indicator in place of its label and icon, sized to the button. It keeps its size and colors, so the layout around it does not shift.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { useState } from 'react'
import { MenuTrigger } from 'react-aria-components'
export default function Loading() {
const [isSending, setSending] = useState(false)
const send = async () => {
setSending(true)
await new Promise((resolve) => setTimeout(resolve, 3000))
setSending(false)
}
return (
<SplitButton size="m">
<SplitButtonLeading isPending={isSending} onPress={send}>
Send
</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More send options" />
<MenuPopover>
<Menu>
<MenuItem>Schedule send</MenuItem>
<MenuItem>Save as draft</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}- Presses: A pending leading button ignores presses and shows no hover. As a submit button, it does not submit its form, and as a link, it does not navigate. The trailing button still opens the menu.
- Focus: It keeps the focus, so a keyboard user stays on it while the action runs.
- Children: Its children are hidden while it is pending. See Pending content.
Color
A variant sets the colors of both buttons. To use other color roles, pass their classes in the className of each button: a container color, and the on-color of that container for the label and the icons.
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Colors() {
return (
<SplitButton variant="tonal">
<SplitButtonLeading className="bg-tertiary-container text-on-tertiary-container">
Reply
</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing
className="bg-tertiary-container text-on-tertiary-container"
aria-label="More reply options"
/>
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Sizes
For larger or smaller split buttons, set size on the SplitButton to xs, s (the default), m, l or xl.
| Size | Height | Leading icon | Trailing button |
|---|---|---|---|
xs | 32dp | 20dp | 48dp wide |
s | 40dp | 20dp | 48dp wide |
m | 56dp | 24dp | 56dp wide |
l | 96dp | 32dp | 96dp wide |
xl | 136dp | 40dp | 136dp wide |
import {
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
const sizes = ['xs', 's', 'm', 'l', 'xl'] as const
export default function Sizes() {
return (
<>
{sizes.map((size) => (
<SplitButton key={size} size={size}>
<SplitButtonLeading>Reply</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label={`More reply options, ${size}`} />
<MenuPopover>
<Menu>
<MenuItem>Reply all</MenuItem>
<MenuItem>Forward</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
))}
</>
)
}The leading button is as tall as a Button of the same size, with its label in the same type style. For xs and s, the trailing button is at least 48dp wide, wider than it is tall.
Rendering non-native buttons
Set elementType on the SplitButtonLeading to render it as an element other than a <button>. The element gets the button role and a tab stop, as on a button.
Links
Set elementType="a" on the SplitButtonLeading to render it as a link, with href, target and rel. The browser follows it as a native link, without a client-side router. To follow it through a router, see Third-party routing library.
import {
Icon,
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
const spec = 'https://m3.material.io/components/split-button'
export default function LinkSplitButton() {
return (
<SplitButton variant="elevated">
<SplitButtonLeading
elementType="a"
href={`${spec}/overview`}
target="_blank"
rel="noreferrer"
>
Read the spec
<Icon name="open_in_new" />
</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More pages of the spec" />
<MenuPopover>
<Menu>
<MenuItem href={`${spec}/specs`} target="_blank" rel="noreferrer">
Specs
</MenuItem>
<MenuItem href={`${spec}/guidelines`} target="_blank" rel="noreferrer">
Guidelines
</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}Note: The trailing button cannot be a link. elementType="a" on a SplitButtonTrailing is a type error.
Customization
Pass classes in className to restyle one split button: on the SplitButton for the element around the two buttons, and on each button for the button itself. A class of yours replaces the component's own class for the same property. See Styling for the classes, the states and the theme.
import {
Icon,
Menu,
MenuItem,
MenuPopover,
SplitButton,
SplitButtonLeading,
SplitButtonTrailing,
} from '@material-web/react'
import { MenuTrigger } from 'react-aria-components'
export default function Custom() {
return (
<SplitButton variant="tonal" className="density-2">
<SplitButtonLeading>
{({ isHovered }) => (
<>
<Icon name="bookmark" className={isHovered ? 'icon-filled' : undefined} />
Save
</>
)}
</SplitButtonLeading>
<MenuTrigger>
<SplitButtonTrailing aria-label="More save options" />
<MenuPopover>
<Menu>
<MenuItem>Save to a list</MenuItem>
<MenuItem>Save and share</MenuItem>
</Menu>
</MenuPopover>
</MenuTrigger>
</SplitButton>
)
}- Density: Add
density-1,density-2ordensity-3to theSplitButton, or to an element around it. Each step makes both buttons 4dp shorter. See Density. - States: Style a state of either button with its variant, such as
hover:orpressed:. In your own CSS, select the same states on either button by their data attributes:data-hovered,data-pressed,data-focused,data-focus-visibleanddata-disabled. See States. - Functions: Pass a function as the children of a
SplitButtonLeadingto render them from the button's state:isHovered,isPressed,isFocused,isFocusVisible,isDisabledandisPending. TheclassNameandstyleof either button can be functions of the same state. See Children as a function. - Every split button: To restyle all the split buttons at once, change the theme.
Limitations
Link role
A leading button rendered as an <a> keeps the button role, so assistive technology announces it as a button and not as a link. A disabled one has no href.
Disabled buttons
A disabled button cannot be focused and reports no hover, so it shows no tooltip.
Pending content
A pending leading button shows only its loading indicator. Children written for the pending state, such as a Sending… label, are hidden too. For a button that shows other content while pending, build a complex button.
Use cases
Material lists what people should be able to do with assistive technology:
- Navigate to each button and interact with them
- Navigate to any element opened by the trailing button
- Understand the current selection state of the button
Interaction and style
- States: Each button shows a state layer on hover and a ripple on a press, and its inner corner grows rounder on hover, keyboard focus and press. Keyboard focus shows a focus ring, and a press with a mouse or touch does not. While the menu is open, the trailing button turns its icon and becomes round, and keeps its colors.
- Touch target: Both buttons of every size have a touch target of at least 48dp, as Material advises. For
xsands, the target reaches above and below the button, and both buttons are at least 48dp wide, so that their targets do not overlap. - Color contrast: Every variant keeps the leading button's label at 4.5:1 contrast or more with its container, and the trailing button's icon at 3:1 or more, in the light and dark schemes at every contrast level. Keep that contrast when you change their colors.
- Motion: With reduced motion, the changes of shape and color, and the turn of the icon, are instant.
- Forced colors: In forced colors, both buttons keep an edge.
- Right to left: The split button is mirrored in a right-to-left layout, with the leading button on the right.
Focus
- The split button is not a tab stop. Tab moves the focus to the leading button and then to the trailing button, as Material advises, in a right-to-left layout too.
- A disabled button cannot be focused, and Tab skips it.
- In a
MenuTrigger, the menu takes the focus as it opens, and gives it back to the trailing button as it closes. - A pending leading button keeps the focus, so a keyboard user stays on it while the action runs.
Keyboard navigation
| Keys | Actions |
|---|---|
| Tab | Move the focus to the leading button, and then to the trailing button |
| Space or Enter | Press the focused button, or open the menu from the trailing button |
| Up or Down arrow | Open the menu from the trailing button, with the last or first item focused |
- In the open menu, the keys are those of a menu.
Labeling elements
- The label names the leading button, as it names a button. With an icon alone, set an
aria-label: anIconis hidden from assistive technology, so it does not name the button. - The trailing button has no visible text, so an
aria-labelor anaria-labelledbyis required. Material advises one that says it holds more options related to the leading button's action, such as More watch options next to Watch later. aria-expandedon the trailing button tells assistive technology whether the menu is open.MenuTriggersets it, witharia-haspopup. For anything other than a menu, set them yourself: see Trailing button.- In a
MenuTrigger, the menu is named by the trailing button. Label its items as on a menu. - A pending leading button reports that it is unavailable with
aria-disabled. Its loading indicator is hidden from assistive technology, so its label still names it. - When a focused leading button becomes pending, or stops being pending, screen readers announce it.
SplitButton
variant'elevated' | 'filled' | 'tonal' | 'outlined'Default'filled'Four color options: elevated, filled, tonal, and outlined
Split buttons use the same color schemes as standard buttons.
size's' | 'xs' | 'm' | 'l' | 'xl'Default's'Split buttons have five recommended sizes. These sizes match the sizes offered on buttons and icon buttons:
Extra small
Small (default)
Medium
Large
Extra large
Props of SplitButton (1)
refRef<HTMLDivElement>Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref).
SplitButton also takes the 278 attributes and events of the element it renders.
SplitButtonLeading
isPendingbooleanWhether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers.
Props of SplitButtonLeading (47)
formstringThe
<form>element to associate the button with. The value of this attribute must be the id of a<form>in the same document. See MDN.idstringThe element's unique identifier. See MDN.
aria-labelstringDefines a string value that labels the current element.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.
onClick(e: MouseEvent<FocusableElement>) => voidNot recommended – use
onPressinstead.onClickis an alias foronPressprovided for compatibility with other libraries.onPressprovides additional event details for non-mouse interactions.isDisabledbooleanWhether the button is disabled.
onPress(e: PressEvent) => voidHandler that is called when the press is released over the target.
onPressStart(e: PressEvent) => voidHandler that is called when a press interaction starts.
onPressEnd(e: PressEvent) => voidHandler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
onPressChange(isPressed: boolean) => voidHandler that is called when the press state changes.
onPressUp(e: PressEvent) => voidHandler that is called when a press is released over the target, regardless of whether it started on the target or not.
autoFocusbooleanWhether the element should receive focus on render.
onFocus(e: FocusEvent<Target>) => voidHandler that is called when the element receives focus.
onBlur(e: FocusEvent<Target>) => voidHandler that is called when the element loses focus.
onFocusChange(isFocused: boolean) => voidHandler that is called when the element's focus status changes.
onKeyDown(e: KeyboardEvent) => voidHandler that is called when a key is pressed.
onKeyUp(e: KeyboardEvent) => voidHandler that is called when a key is released.
hrefstringA URL to link to if elementType="a".
targetstringThe target window for the link.
relstringThe relationship between the linked resource and the current page. See MDN.
elementTypeT | JSXElementConstructor<any>Default'button'The HTML element or React element used to render the button, e.g. 'div', 'a', or
RouterLink.aria-disabled'true' | 'false' | booleanIndicates whether the element is disabled to users of assistive technology.
aria-expanded'true' | 'false' | booleanIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-haspopup'dialog' | 'menu' | 'true' | 'false' | 'grid' | 'listbox' | 'tree' | booleanIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-controlsstringIdentifies the element (or elements) whose contents or presence are controlled by the current element.
aria-pressed'true' | 'false' | 'mixed' | booleanIndicates the current "pressed" state of toggle buttons.
aria-current'time' | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | booleanIndicates whether this element represents the current item within a container or set of related elements.
type'button' | 'submit' | 'reset'Default'button'The behavior of the button when used in an HTML form.
preventFocusOnPressbooleanWhether to prevent focus from moving to the button when pressing it.
Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control.
formActionButtonHTMLAttributes<HTMLButtonElement>['formAction']The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner.
formEncTypestringIndicates how to encode the form data that is submitted.
formMethodstringIndicates the HTTP method used to submit the form.
formNoValidatebooleanIndicates that the form is not to be validated when it is submitted.
formTargetstringOverrides the target attribute of the button's form owner.
namestringSubmitted as a pair with the button's value as part of the form data.
valuestringThe value associated with the button's name when it's submitted with the form data.
excludeFromTabOrderbooleanWhether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
onHoverStart(e: HoverEvent) => voidHandler that is called when a hover interaction starts.
onHoverEnd(e: HoverEvent) => voidHandler that is called when a hover interaction ends.
onHoverChange(isHovering: boolean) => voidHandler that is called when the hover state changes.
slotstring | nullA slot name for the component. Slots allow the component to receive props from a parent component. An explicit
nullvalue indicates that the local props completely override all props received from a parent.refRef<ComponentRef<T> & Element>classNameClassNameOrFunction<ButtonRenderProps>styleStyleOrFunction<ButtonRenderProps>childrenChildrenOrFunction<ButtonRenderProps>
SplitButtonTrailing
isPendingbooleanWhether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers.
Props of SplitButtonTrailing (46)
formstringThe
<form>element to associate the button with. The value of this attribute must be the id of a<form>in the same document. See MDN.idstringThe element's unique identifier. See MDN.
aria-labelstringDefines a string value that labels the current element.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.
onClick(e: MouseEvent<FocusableElement>) => voidNot recommended – use
onPressinstead.onClickis an alias foronPressprovided for compatibility with other libraries.onPressprovides additional event details for non-mouse interactions.isDisabledbooleanWhether the button is disabled.
onPress(e: PressEvent) => voidHandler that is called when the press is released over the target.
onPressStart(e: PressEvent) => voidHandler that is called when a press interaction starts.
onPressEnd(e: PressEvent) => voidHandler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
onPressChange(isPressed: boolean) => voidHandler that is called when the press state changes.
onPressUp(e: PressEvent) => voidHandler that is called when a press is released over the target, regardless of whether it started on the target or not.
autoFocusbooleanWhether the element should receive focus on render.
onFocus(e: FocusEvent<Target>) => voidHandler that is called when the element receives focus.
onBlur(e: FocusEvent<Target>) => voidHandler that is called when the element loses focus.
onFocusChange(isFocused: boolean) => voidHandler that is called when the element's focus status changes.
onKeyDown(e: KeyboardEvent) => voidHandler that is called when a key is pressed.
onKeyUp(e: KeyboardEvent) => voidHandler that is called when a key is released.
hrefstringA URL to link to if elementType="a".
targetstringThe target window for the link.
relstringThe relationship between the linked resource and the current page. See MDN.
elementType(props: any) => ReactNode | Promise<ReactNode> | new (props: any, context: any) => Component<any, any, any> | 'button'Default'button'The HTML element or React element used to render the button, e.g. 'div', 'a', or
RouterLink.aria-disabled'true' | 'false' | booleanIndicates whether the element is disabled to users of assistive technology.
aria-expanded'true' | 'false' | booleanIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-haspopup'dialog' | 'menu' | 'true' | 'false' | 'grid' | 'listbox' | 'tree' | booleanIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-controlsstringIdentifies the element (or elements) whose contents or presence are controlled by the current element.
aria-pressed'true' | 'false' | 'mixed' | booleanIndicates the current "pressed" state of toggle buttons.
aria-current'time' | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | booleanIndicates whether this element represents the current item within a container or set of related elements.
type'button' | 'submit' | 'reset'Default'button'The behavior of the button when used in an HTML form.
preventFocusOnPressbooleanWhether to prevent focus from moving to the button when pressing it.
Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control.
formActionButtonHTMLAttributes<HTMLButtonElement>['formAction']The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner.
formEncTypestringIndicates how to encode the form data that is submitted.
formMethodstringIndicates the HTTP method used to submit the form.
formNoValidatebooleanIndicates that the form is not to be validated when it is submitted.
formTargetstringOverrides the target attribute of the button's form owner.
namestringSubmitted as a pair with the button's value as part of the form data.
valuestringThe value associated with the button's name when it's submitted with the form data.
excludeFromTabOrderbooleanWhether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
onHoverStart(e: HoverEvent) => voidHandler that is called when a hover interaction starts.
onHoverEnd(e: HoverEvent) => voidHandler that is called when a hover interaction ends.
onHoverChange(isHovering: boolean) => voidHandler that is called when the hover state changes.
slotstring | nullA slot name for the component. Slots allow the component to receive props from a parent component. An explicit
nullvalue indicates that the local props completely override all props received from a parent.refRef<HTMLButtonElement & Element>classNameClassNameOrFunction<ButtonRenderProps>styleStyleOrFunction<ButtonRenderProps>