← All examplesFlows

Confirm, then run a flow

A compact example: confirm in a popup, run an async action, and show its result.

Confirm, then run

One button opens a confirmation popup; accepting it starts the flow.

Flow: idle

CodeFocused snippet
const flow = useSubmitFlow({
  publish: {
    run: publishNotes,
    confirm: { title: 'Publish these notes?' },
    pendingLabel: 'Publishing…',
    success: 'Notes published.',
  },
})

<SubmitFlowRoot flow={flow}>
  <ActionButton action="publish">Publish notes</ActionButton>
  <SubmitFeedback />
</SubmitFlowRoot>

Read the related guide →

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