radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.93k stars 833 forks source link

[Tabs]: export Tabs context/state manipulation so tab triggers can be iterated on #3123

Open keturiosakys opened 2 months ago

keturiosakys commented 2 months ago

Feature request

Overview

I'd love to be able to access the entire tab (trigger) list from the root of the tab component. I want to be able to iterate over it, not just select a value directly.

Examples in other libraries

React Aria library allows users to access and manipulate the state of the tab list either through the state or even lower useTabsList hook:

Who does this impact? Who is this for?

The main value I find is being able to bind a custom keybind for tabbing over the list without it needing be focused necessarily. For example, the feature I'm creating is allowing users to use [ and ] keys to tab over the components in a multipane setup (similar to lazygit: https://github.com/jesseduffield/lazygit/discussions/1861