FocusScope

utilities

A utility that traps focus within a container, useful for accessible modals and overlays.

Preview
Tab cycles within

Installation

npm install @launchapp/design-system
Import
import { FocusScope } from "@launchapp/design-system";

Examples

Trapped Focus

<FocusScope trapped loop>  <div className="flex gap-2 p-4 border rounded">    <Button>First</Button>    <Button>Second</Button>    <Button>Third</Button>  </div></FocusScope>

Props

PropTypeDefaultDescription
trapped
booleanfalseWhether focus is trapped within the scope.
loop
booleanfalseWhether tab navigation loops within the scope.
onMountAutoFocus
(event: Event) => voidHandler for auto-focus on mount.
onUnmountAutoFocus
(event: Event) => voidHandler for auto-focus on unmount.
asChild
booleanfalseRender as child element via Radix Slot.