Skip to content

Confirm ​

Confirm is a modal that asks before an action.

When to use ​

Use it before an action that removes something or cannot be undone, and before one whose effect reaches other people. The title is the question ("Delete 4 items?") and the message says what happens. A destructive action is danger; its button is the one red fill a Footer may hold.

Props ​

PropDefaultDescription
openfalseWhether it is open (bindable)
titlerequiredThe question
messageOne paragraph of body
childrenA body in place of the message
confirmLabelthe confirm messageThe name of the action
cancelLabelthe cancel messageThe name of cancel
dangerfalseA destructive action: the button is danger-fill
busyfalseThe action is running: its button is dimmed
disabledfalseThe action cannot run yet
onconfirmrequiredCalled when the action is confirmed
oncancelCalled once when it closes without confirming
inlinefalseThe same surface in the flow, for documentation

Contract ​

It is a small Modal (25rem) in the centre of every screen, gap-md from its edges, with the role alertdialog. The Footer holds cancel, then the action as primary or danger-fill. It opens with the focus on cancel, so Enter does not confirm by accident. Escape and the close button close it and call oncancel; a press on the scrim does nothing. Confirming calls onconfirm and leaves it open: the application shows busy while the work runs and sets open to false when it is done.

Example ​

Confirm

Released under the Apache-2.0 license.