FocusTrap
Traps keyboard focus within a container element
Accessibility
- Treat the component as presentational unless it exposes interactive affordances, and label any interactive affordances explicitly.
- Keep heading, reading, and focus order aligned with the surrounding content.
- Keep the opening control labeled, ensure focus moves predictably on open and close, and expose the popup type truthfully.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
Import options
Root package
ts
import { FocusTrap } from '@dryui/ui' Per-component subpath
ts
import { FocusTrap } from '@dryui/ui/focus-trap' API
Props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Description | Default | Required | Bindable |
|---|---|---|---|---|---|
| active | boolean | — | — | — | — |
| initialFocus | string | — | — | — | — |
| returnFocus | boolean | — | — | — | — |
| children | Snippet | Content rendered inside the component. | — | — | — |