Toggle Group
A toggle button group provides an intuitive way for users to switch between multiple options, supporting both single and multi-selection modes.
Basic
A toggle button group allows users to switch between multiple options, enabling one or more selections at a time.
Installation
If you hit any issues, make sure you check out the installation guide here for more information.
Composed Components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
The Toggle Group comes packed with several components to enhance functionality and provide a seamless experience.
Manual Installation
Make sure you also install the composed components and the required packages for the component to function properly.
Anatomy
Orientation
By default, the toggle button group is arranged horizontally. Use the orientation
prop to switch to a vertical layout.
Selection Mode
Modify the selection behavior using the selectionMode
prop.
Appearance
Customize the look of the toggle button group with the appearance
prop.
Gap
By default, the toggle button group has no spacing between buttons. Adjust the spacing using the gap
prop.
Avoid setting the gap to 0
when using the plain
appearance.
Size
By default, the toggle button group has a medium size. You can change the size by using the size
prop.
Controlled
You can control the state of the toggle button group by using the selectedKeys
prop.
Selected: bold
Disabled
You can disable an entire toggle group by setting the isDisabled
prop on the ToggleGroup
component, which disables all toggles in the group. Alternatively, you can disable specific toggle buttons individually by setting the isDisabled
prop on the Toggle
component.