Skip to contents

Toolbar

A container for grouping a set of buttons and controls.

View as Markdown

Usage guidelines

To ensure that toolbars are accessible and helpful, follow these guidelines:

  • Use inputs sparingly: Left and right arrow keys are used to both move the text insertion cursor in an input, and to navigate among controls in horizontal toolbars. When using an input in a horizontal toolbar, use only one and place it as the last element of the toolbar.

Anatomy

Import the component and assemble its parts:

Anatomy

Examples

Using with Menu

All Base UI popup components that provide a Trigger component can be integrated with a toolbar by passing the trigger to <Toolbar.Button> with the render prop:

Using popups with toolbar

This applies to <AlertDialog>, <Dialog>, <Menu>, <Popover>, and <Select>.

Using with Tooltip

Unlike other popups, the toolbar item should be passed to the render prop of <Tooltip.Trigger>:

Using popups with toolbar

Using with NumberField

To use a NumberField in the toolbar, pass <NumberField.Input> to <Toolbar.Input> using the render prop:

Using NumberField with toolbar

API reference

Root

A container for grouping a set of controls, such as buttons, toggle groups, or menus. Renders a <div> element.

loopFocus
boolean
true
Description

If true, using keyboard navigation will wrap focus to the other end of the toolbar once the end is reached.

Type
boolean | undefined
Default
true
disabled
boolean
Type
boolean | undefined
orientation
Toolbar.Root.Orientation
'horizontal'
Description

The orientation of the toolbar.

Type
Default
'horizontal'
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation
Indicates the orientation of the toolbar.
data-disabled
Present when the toolbar is disabled.

Additional Types

Toolbar.Root.Props

Re-Export of Root props as ToolbarRootProps

Toolbar.Root.State
Toolbar.Root.Orientation
Toolbar.Root.ItemMetadata

Button

A button that can be used as-is or as a trigger for other components. Renders a <button> element.

focusableWhenDisabled
boolean
true
Description

When true the item remains focuseable when disabled.

Type
boolean | undefined
Default
true
nativeButton
boolean
true
Description

Whether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).

Type
boolean | undefined
Default
true
disabled
boolean
false
Description

When true the item is disabled.

Type
boolean | undefined
Default
false
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation
Indicates the orientation of the toolbar.
data-disabled
Present when the button is disabled.
data-focusable
Present when the button remains focusable when disabled.

Additional Types

Toolbar.Button.Props

Re-Export of Button props as ToolbarButtonProps

Toolbar.Button.State

A link component. Renders an <a> element.

className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation
Indicates the orientation of the toolbar.

Additional Types

Toolbar.Link.Props

Re-Export of Link props as ToolbarLinkProps

Toolbar.Link.State

Input

A native input element that integrates with Toolbar keyboard navigation. Renders an <input> element.

defaultValue
Union
Type
focusableWhenDisabled
boolean
true
Description

When true the item remains focuseable when disabled.

Type
boolean | undefined
Default
true
disabled
boolean
false
Description

When true the item is disabled.

Type
boolean | undefined
Default
false
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation
Indicates the orientation of the toolbar.
data-disabled
Present when the input is disabled.
data-focusable
Present when the input remains focusable when disabled.

Additional Types

Toolbar.Input.Props

Re-Export of Input props as ToolbarInputProps

Toolbar.Input.State

Group

Groups several toolbar items or toggles. Renders a <div> element.

disabled
boolean
false
Description

When true all toolbar items in the group are disabled.

Type
boolean | undefined
Default
false
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation
Indicates the orientation of the toolbar.
data-disabled
Present when the group is disabled.

Additional Types

Toolbar.Group.Props

Re-Export of Group props as ToolbarGroupProps

Separator

A separator element accessible to screen readers. Renders a <div> element.

orientation
Toolbar.Root.Orientation
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type
data-orientation
Indicates the orientation of the toolbar.

Additional Types

Toolbar.Separator.Props

Re-Export of Separator props as ToolbarSeparatorProps

Toolbar.Separator.State