← All examplesFlows

Three actions: save, discard, or cancel

Handle unsaved edits in a dialog with two async actions and an explicit cancel choice.

Unsaved changes

Save your edits, discard them, or cancel to keep editing. During a request, Cancel stops the work and keeps the dialog open.

No changes have been saved or discarded.

Three actions · one flow

Save your changes?

You have unsaved edits to the launch announcement. Choose what to keep before leaving.

Launch announcement

Updated headline and two new release highlights.

Draft · Unsaved changes
CodeFocused snippet
<SubmitFlowRoot flow={flow}>
  <CancelButton onCancel={closeDialog}>Cancel</CancelButton>
  <ActionButton action="discard">Discard changes</ActionButton>
  <ActionButton action="save">Save changes</ActionButton>
  <SubmitFeedback />
</SubmitFlowRoot>
// Render inside your dialog. Both actions share the flow's busy lock.

Read the related guide →

This demo uses a local, temporary action. It does not send data or write to a service.