# Focus-Trapped Modal Kit

https://fieldbook.lizardi.mx/components/focus-trapped-modal-kit

Category: Overlays
![Still of the Focus-Trapped Modal Kit component, a Fieldbook UI component in Overlays.](https://fieldbook.lizardi.mx/thumbs/focus-trapped-modal-kit.webp)
Preview video: https://ejpqcxcjbiyabxkx.public.blob.vercel-storage.com/previews/focus-trapped-modal-kit-d82f9a88ec.mp4 (5 s, silent)

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.

## Frameworks

react, vue, svelte, astro, html

## Preview controls

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

| Name | Type | Default | Options or constraints |
| --- | --- | --- | --- |
| from | select | top | Options: top, bottom, left, right |
| trapFocus | boolean | true | No additional limit in the metadata. |
| accent | color | #F5C542 | No additional limit in the metadata. |
| label | text | Session settings | Up to 50 characters |

## Usage notes

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

### 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.

## Install through MCP

Connect your client, call get_component to retrieve the implementation, then get_install_command for installation instructions. Choose a listed framework, integrate the returned source and verify it in your application.

```json
{
  "tool": "get_component",
  "arguments": {
    "slug": "focus-trapped-modal-kit",
    "framework": "react"
  }
}
```

[For agents](https://fieldbook.lizardi.mx/docs/agents)
[MCP](https://fieldbook.lizardi.mx/api/mcp)

## Related open components

- [Bounce warning dialog](https://fieldbook.lizardi.mx/components/bounce-warning-dialog)
- [Centered modal frame](https://fieldbook.lizardi.mx/components/centered-modal-frame)
- [Confirm action modal](https://fieldbook.lizardi.mx/components/confirm-action-modal)
- [Consequence confirm dialog](https://fieldbook.lizardi.mx/components/consequence-confirm-dialog)
- [Destructive confirm dialog](https://fieldbook.lizardi.mx/components/destructive-confirm-dialog)
- [Perspective reveal dialog](https://fieldbook.lizardi.mx/components/perspective-reveal-dialog)
