Skip to content
syntaqx

Components · Overlays

Dialog

shadcn's Dialog: a modal that traps focus while open, closes on Escape or a click outside, and hands focus back to whatever opened it.

Installation

npx shadcn@latest add https://www.syntaqx.com/r/dialog.json

Examples

Focus comes home

Opening a dialog moves focus into it; closing it puts focus back on whatever opened it. Without that, a keyboard user who closes a dialog starts over from the top of the page. Open each with the keyboard and close it with Esc.

Inspired by WAI-ARIA APG