Toggle Group
Provides a shared state to a series of toggle buttons.
View as MarkdownAnatomy
Import the component and use it as a single part:
import { ToggleGroup } from '@base-ui-components/react/toggle-group';
<ToggleGroup />
API reference
defaultValue
any[]
any[]
- Name
- Description
The open state of the toggle group represented by an array of the values of all pressed toggle buttons. This is the uncontrolled counterpart of
value
.- Type
any[]
value
any[]
any[]
- Name
- Description
The open state of the toggle group represented by an array of the values of all pressed toggle buttons. This is the controlled counterpart of
defaultValue
.- Type
any[]
onValueChange
function
function
- Name
- Description
Callback fired when the pressed states of the toggle group changes.
- Type
((groupValue: any[], event: Event) => void)
toggleMultiple
boolean
(default: false
)
boolean
false
- Name
- Description
When
false
only one item in the group can be pressed. If any item in the group becomes pressed, the others will become unpressed. Whentrue
multiple items can be pressed.- Type
boolean
- Default
false
disabled
boolean
(default: false
)
boolean
false
- Name
- Description
Whether the toggle group should ignore user interaction.
- Type
boolean
- Default
false
loop
boolean
(default: true
)
boolean
true
- Name
- Description
Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.
- Type
boolean
- Default
true
orientation
Orientation
(default: 'horizontal'
)
Orientation
'horizontal'
- Name
- Type
Orientation
- Default
'horizontal'
className
string | function
string | 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: Toggle.Group.State) => string)
render
ReactElement | function
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
| ReactElement
| ((props: HTMLProps, state: Toggle.Group.State) => ReactElement)
data-orientation
Indicates the orientation of the toggle group.
data-disabled
Present when the toggle group is disabled.
data-multiple
Present when the toggle group allows multiple buttons to be in the pressed state at the same time.