Button Group
Groups a collection of similar actions together.
When to use
- If you need to emphasize context of similar actions.
- If a single option or multiple options of the set may be selected.
Examples
In radio
mode, the button group functions similarly to a radio group. Only one button can be "selected" at a time.
In checkbox
mode, the button group functions similarly to a group of checkboxes. Multiple buttons can be "selected" at the same time.
You can disable the entire button group as in the example above. Or you can disable isolated buttons as in the example below.
As with many of our components, there is also an uncontrolled version, StatefulButtonGroup
, which manages its own state. If mode
is set to radio
or checkbox
, this stateful version of the component will adapt to keep track of the selected
value(s).
API
ButtonGroup props
Name | Type | Description |
---|---|---|
children | react node | Buttons within the group |
disabled | boolean | Indicates that the button group is disabled |
mode | enum | Changes keyboard shortcuts and role attributes. The actual onClick update implementation is up to you. |
onClick | function | Function called when any button is clicked. |
overrides | custom | Lets you customize all aspects of the component. |
selected | array | Defines which buttons are selected |
shape | enum | Defines the shape of the button in the button group. |
size | enum | Defines the size of the button. |
ButtonGroup exports
You can import this module like so:
import {ButtonGroup} from 'baseui/button-group'
It exports the following components or utility functions: