Modal
Focused dialogs that pause the page for a decision. Keep one primary action on the right; the close button and Cancel both dismiss.
Dialog
Click the button. Esc, the close button, Cancel and the backdrop all dismiss.
<Modal
open={open}
onClose={() => setOpen(false)}
title="Rename project"
subtitle="Everyone on the team will see the new name."
footer={<>
<Button variant="outline" onClick={close}>Cancel</Button>
<Button onClick={save}>Save changes</Button>
</>}
>
<Input defaultValue="Maple website" />
</Modal>Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | Visibility. |
onClose | () => void | — | Called on Esc, backdrop or close. |
title | ReactNode | — | Title. |
subtitle | ReactNode | — | Supporting line. |
size | "s" | "m" | "s" | 400 / 560px wide. |
footer | ReactNode | — | Buttons, primary on the right. |
Usage
Do
- Keep one primary action, on the right.
- Let Esc and Cancel dismiss.
Don't
- Stack modals on modals.