A collection of React hooks for accessibility, focus management, and motion preferences. Used internally by all edbn/ui components.
All hooks live in the hooks/ directory. Install them using the CLI or copy the source code manually.
Install hooks directly into your project using the shadcn CLI. Pick the ones you need.
Detects the user's prefers-reduced-motion preference with support for manual overrides.
Locks body scroll when modals or sheets are open. Supports multiple simultaneous instances.
Traps keyboard focus within a container. Essential for accessible modal dialogs.
Detects low-power devices using Battery API and hardware detection.
Dependencies
useLowPowerDevice hook may require browser APIs like the Battery API.Detects clicks outside a referenced element. Useful for closing dropdowns and popovers.
Generates SSR-safe unique IDs for accessibility attributes like aria-labelledby and aria-describedby. Uses React 18's useId when available.
Enables components to work in both controlled and uncontrolled modes. Includes a specialized useControllableBoolean for open/close states.
Merges multiple refs into a single callback ref. Essential for components that need to forward refs while also using them internally.
SSR Safety
useSyncExternalStore for hydration safety.