Button
A button component that can be rendered as another tag or focusable when disabled.
View as MarkdownAnatomy
Import the component:
import { Button } from '@base-ui-components/react/button';
<Button />API reference
focusableWhenDisabledboolean
false
focusableWhenDisabledboolean
false
- Description
- Whether the button should be focusable when disabled. 
- Type
- boolean | undefined
- Default
- false
nativeButtonboolean
—
nativeButtonboolean
—- Name
- Type
- boolean | undefined
styleReact.CSSProperties | function
—
styleReact.CSSProperties | function
—- Name
- Type
- | React.CSSProperties | ((state: Button.State) => CSSProperties | undefined) | undefined
disabledboolean
—
disabledboolean
—- Name
- Description
- Whether the button should ignore user interaction. 
- Type
- boolean | undefined
classNamestring | function
—
classNamestring | function
—- Name
- Description
- CSS class applied to the element, or a function that returns a class based on the component’s state. 
- Type
- | string | ((state: Button.State) => string | undefined)
renderReactElement | function
—
renderReactElement | function
—- Name
- Description
- Allows you to replace the component’s HTML element with a different tag, or compose it with another component. - Accepts a - ReactElementor a function that returns the element to render.
- Type
- | ReactElement | ((props: HTMLProps, state: Button.State) => ReactElement)
data-disabled
Present when the button is disabled.
Examples
Rendering as another tag
The button can remain keyboard accessible while being rendered as another tag, such as a <div>, by specifying nativeButton={false}.
import { Button } from '@base-ui-components/react/button';
<Button render={<div />} nativeButton={false}>
  Button that can contain complex children
</Button>Loading states
For buttons that enter a loading state after being clicked, specify the focusableWhenDisabled prop to ensure focus remains on the button when it becomes disabled. This prevents focus from being lost and maintains the tab order.