dialog
a square sheet over a scrim, for the one decision that has to stop the page. focus stays inside until it closes.
bunx --bun shadcn@latest add @mk/dialogin both modes
the sheet sits on the sheet lift over a scrim: the key at 42 percent in light, black at 60 percent in dark. in light a 1-bit screen prints along its contact edge. in dark there is no screen, only the shadow.
each frame below stands in for the window. the sheet centres in it the way it centres on a screen, and its offsets round to whole pixels, so its edges stay crisp at 1x and 2x.
- chapter 8waves that keep their shape
- chapter 9what a measurement does
- chapter 10the double slit, again
- chapter 11spin, without the spinning
- chapter 8waves that keep their shape
- chapter 9what a measurement does
- chapter 10the double slit, again
- chapter 11spin, without the spinning
draws where a floating layer meets the page, under its soft lift
try it
this one opens for real, in the page’s mode. escape, the close button or a click on the scrim closes it. switch the mode at the foot of the nav to see the other.
parts
the names and props are shadcn’s, from base-nova, on base ui’s dialog. markup written for shadcn’s dialog works unchanged.
Dialog- the root. pass
openandonOpenChangeto control it. DialogTrigger- opens it. hand it a button through
render. DialogContent- the sheet, with its scrim and its close button.
showCloseButton={false}drops the button. DialogHeader- holds
DialogTitle, in the subtitle step, andDialogDescription, in the muted ink. DialogFooter- the actions: stacked on a phone, in a row from 640 px.
showCloseButtonadds a close. DialogClose- closes it. hand it a button through
render.