Preferred / most accessible way to create a segmented control with react-aria-components? #7274
-
It looks like there are a few possible ways to create an Apple-style segmented control with react-aria-components: using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We're about to add a ToggleButtonGroup component for this (see #7264), but a RadioGroup also works if you only need single selection. TagGroup and GridList are probably overkill. Depending on your UI, you could potentially also use Tabs. If the segmented control swaps an associated view between different content, then Tabs would be appropriate. If it's making a selection (like bold/italic/underline buttons), or swapping between views of the same content (e.g. table vs cards of the same items), then ToggleButtonGroup (eventually) or RadioGroup would be more appropriate. |
Beta Was this translation helpful? Give feedback.
We're about to add a ToggleButtonGroup component for this (see #7264), but a RadioGroup also works if you only need single selection. TagGroup and GridList are probably overkill.
Depending on your UI, you could potentially also use Tabs. If the segmented control swaps an associated view between different content, then Tabs would be appropriate. If it's making a selection (like bold/italic/underline buttons), or swapping between views of the same content (e.g. table vs cards of the same items), then ToggleButtonGroup (eventually) or RadioGroup would be more appropriate.