FocusTrap
Keeps Tab inside while active, focuses the first control (or an element with data-autofocus), and restores focus on deactivation.
Props
activebooleanDefault:trueTrap focus while true.
classNamestringDefault:''Extra classes for the root element.
childrenReactNodeContent.
...restAny other props are passed to the underlying element.
| Prop | Type | Default | Description |
|---|---|---|---|
active | boolean | true | Trap focus while true. |
className | string | '' | Extra classes for the root element. |
children | ReactNode | – | Content. |
...rest | – | Any other props are passed to the underlying element. |
Related hooks and theme:useDialogFocus