Ark Logo
Reat
Components
Toggle group

Toggle Group

A set of two-state buttons that can be toggled on or off.

Anatomy

To set up the toggle group correctly, you'll need to understand its anatomy and how we name its parts.

Each part includes a data-part attribute to help identify them in the DOM.

Examples

Learn how to use the ToggleGroup component in your project. Let's take a look at the most basic example:

Multiple Selection

Demonstrates how to enable multiple selection within the group.

Initial Value

Shows how to set an initial value in the toggle group.

Using the Root Provider

The RootProvider component provides a context for the toggle-group. It accepts the value of the useToggle-group hook. You can leverage it to access the component state and methods from outside the toggle-group.

If you're using the RootProvider component, you don't need to use the Root component.

API Reference

Accessibility

Keyboard Support

KeyDescription
Tab
Moves focus to either the pressed item or the first item in the group.
Space
Activates/deactivates the item.
Enter
Activates/deactivates the item.
ArrowDown
Moves focus to the next item in the group.
ArrowRight
Moves focus to the next item in the group.
ArrowUp
Moves focus to the previous item in the group.
ArrowLeft
Moves focus to the previous item in the group.
Home
Moves focus to the first item.
End
Moves focus to the last item.