Modal
The general dialog: focus-trapped, scroll-locking, with a titled header, a scrolling body and a footer action row.
import { Modal, Button, ButtonRow, Field, Input } from '@objectifthunes/whiteboard'
<Modal
open={open}
onClose={() => setOpen(false)}
title="New project"
description="Projects group your boards and their members."
footer={
<ButtonRow>
<Button variant="secondary" onClick={() => setOpen(false)}>Cancel</Button>
<Button onClick={submit}>Create</Button>
</ButtonRow>
}
>
<Field label="Name"><Input autoFocus /></Field>
</Modal>Three sizes: sm (24rem), md (34rem, the default) and lg (52rem). The body is the only scrolling part, so the title and the action row never leave the screen.
Focus moves to the first focusable element on open, is trapped while open, and returns to whatever was focused before on close. Background scrolling locks, and the scrollbar gutter is padded out so the page behind does not jump.
For a destructive yes/no prompt use ConfirmDialog instead — it is this shape with the copy and the danger button already decided. Set closeOnBackdrop={false} for dialogs the user must resolve with a button.
Nested overlays are safe: the scroll lock counts depth and only lifts when the last one closes, and Escape stops propagating so one dialog closes at a time.