-
-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Feature request
Summary
Expose Root context hooks for Base UI components to allow developers to access internal component state and behaviors when building custom subcomponents.
Currently, many Base UI components manage their state internally through a Root provider (e.g. open, value, active item, disabled, etc.), but the corresponding context hooks are not publicly exported. Providing access to these hooks would enable advanced composition while still leveraging Base UIโs built-in logic and accessibility features.
For example, hooks such as:
useCheckboxRootContext()useSwitchRootContext()
would allow developers to build custom triggers, indicators, animations, or wrappers that interact with the component state.
Motivation
When building real-world applications or internal design systems, developers often need to:
- Create custom triggers or controls
- Add custom animations or transitions
- Build design system wrappers
- Access state such as:
openselected valueactive itemdisabled
Without access to the Root context, developers may need to:
- Re-implement component logic
Exposing official context hooks would improve:
- Composability
- Extensibility
- Developer experience
- Design system integration
while still keeping the internal implementation consistent and accessible.