Sakani

Modal

A blocking dialog with a focus trap, for decisions that can't be deferred.

Use it sparingly

A modal takes the whole page hostage. That's the right trade for a destructive confirmation or a short required form, and the wrong one for anything browsable — a Popover leaves the page behind it usable.

Destructive

Name the consequence in the title and quantify it in the description. "Delete this workspace?" with "all 482 records" is answerable; "Are you sure?" isn't.

Custom body

While an action is in flight

Turn off closeOnEscape and closeOnBackdropClick while confirming, so a stray click can't dismiss the dialog mid-request and leave people unsure whether it went through.

See the code tab.

Props

PropTypeDefaultDescription
openbooleanWhether the dialog is shown. Fully controlled.
onClose() => voidFires from the ×, Escape, and backdrop click.
titlestringDialog heading.
descriptionstringSupporting copy under the title.
variant'default' | 'destructive''default'Destructive adds a warning icon and tints the confirm button.
iconReactNodeOverrides the destructive variant's TriangleAlert.
childrenReactNodeCustom body between the description and the footer.
confirmLabel / cancelLabelstringFooter button labels.
onConfirm() => voidConfirm handler.
onCancel() => voidonCloseCancel handler; falls back to onClose.
confirmLoadingbooleanfalsePuts the confirm button in its loading state.
closeOnEscapebooleantrueSet false to force a decision.
closeOnBackdropClickbooleantrueSet false to force a decision.