Skip to content
Menu

Overlays

Focus-Trapped Modal Kit

Focus-Trapped Modal Kit: A bare-bones modal foundation whose whole point is disciplined keyboard behavior: it traps focus while open and restores it precisely on close, wrapped in a tilt-in entrance.

Using Focus-Trapped Modal Kit

Focus-Trapped Modal Kit uses the card preview frame with a light/dark theme setting.

Customize the preview

These controls are passed to the demo. Defaults and limits describe the preview; consult the implementation for its full prop API.

ControlTypeDefaultPreview limits
fromselecttopOptions: top, bottom, left, right
trapFocusbooleantrueNo additional limit in the metadata.
accentcolor#F5C542No additional limit in the metadata.
labeltextSession settingsUp to 50 characters
Which frameworks are available for Focus-Trapped Modal Kit?

Focus-Trapped Modal Kit is available for React, Vue, Svelte, Astro, HTML. The live preview uses React; the source observations below apply to index.tsx. Check the selected port before relying on the same interactions.

What does Focus-Trapped Modal Kit depend on?

The React metadata lists these npm dependencies beyond React: motion, clsx, tailwind-merge.

What accessibility details are visible in Focus-Trapped Modal Kit?

The React source for Focus-Trapped Modal Kit includes: native elements (button); attributes and handlers (aria-checked, aria-hidden, aria-label, aria-modal, onKeyDown, tabIndex); explicit roles (dialog, switch); key comparisons (Escape, Tab). These are source observations. Verify accessible names, focus order and keyboard behavior in the composed page.

How does Focus-Trapped Modal Kit handle reduced motion?

Focus-Trapped Modal Kit reads the motion preference in its React source through useReducedMotion(). Preference-dependent expressions in index.tsx: duration: reduced ? 0 : 0.18; enter: reduced ? { duration: 0.14 } : { type: "spring", stiffness: 260, damping: 24, mass: 0.85 }; exit: reduced ? { duration: 0.1 } : { duration: 0.16, ease: [0.4, 0, 1, 1] }. Check the full implementation, shared styles and selected port with reduced motion enabled; these observations do not establish that every animation stops.

Connect your agent

Related open components