Dialog

@sushindustries/ui

A native dialog driven by props: top layer, focus trap and Escape from the element, click-outside from here.

5 min read
View as MarkdownEdit on GitHub

Dialog is a native <dialog> driven entirely by props: open shows it modal, and onClose fires from Escape, the backdrop, or its own close button. Reach for it to hold a reader until they answer something, like a confirmation - not for a menu meant to be dismissed in passing.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/dialog.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/dialog.json

Why it is built this way

showModal already supplies the top layer, focus trap, Escape and the backdrop, so this component adds only what is missing: the frame, the title the dialog is labelled by, and click-outside. Command Palette is this same recipe with a filter bolted on, and the two stay separate components because a dialog's job is to hold the page, and a palette's is to let you leave it quickly.

Install

tanstack add https://adamjurek.com/r/tanstack/dialog.json
shell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/dialog.json
shell
pnpm add @sushindustries/ui @sushindustries/atoms
shell

What you get

Version0.1.0
Categorylayout · Overlays
Filesdialog.tsx
DependenciesNone
Also installsiconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content
Tagsmodal, no-deps

No runtime dependencies

It brings nothing with it beyond the stylesheet.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content