Button Group
A container that groups related buttons together with consistent styling.
Installation
Copy the following code into your app directory.
Command
Command
Manual
Manual
uv
Anatomy
Use the following composition to build a Button Group component.
Accessibility
The button_group.root component has the role attribute set to group.
Use Tab to navigate between the buttons in the group.
Use aria-label or aria-labelledby to label the button group.
Examples
Orientation
Set the orientation prop to change the button group layout.
Size
Control the size of buttons using the size prop on individual buttons.
Separator
The button_group.separator component visually divides buttons within a group.
Buttons with variant outline do not need a separator since they have a border. For other variants, a separator is recommended to improve the visual hierarchy.
Split
Create a split button group by adding two buttons separated by a button_group.separator.
Input
Wrap an input component with buttons.
Dropdown Menu
Create a split button group with a menu component.
Select
Pair with a select component.
API Reference
button_group.root
The button_group.root component is a container that groups related buttons together with consistent styling.
button_group.separator
The button_group.separator component visually divides buttons within a group.
button_group.text
Use this component to display text within a button group.
The button_group.text accepts *children so any interactive component passed to it will be rendered. Use it to render a custom component as the text, for example a label.