Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Confirm Morph
  3. API and Development

Confirm Morph

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import ConfirmMorph, ConfirmMorphTone from @prepared911/ui/confirm-morph. ConfirmMorphProps is ConfirmMorphOwnProps and the optional Undo pair, plus data-* attributes on the root.
PropTypeDefaultDescription
labelLocalizedMessagerequiredTrigger label
promptLocalizedMessagerequiredPrompt on the confirming face; announced
confirmLabelLocalizedMessagerequiredConfirm button
cancelLabelLocalizedMessagerequiredCancel button
pendingLabelLocalizedMessagerequiredPending face; announced
doneLabelLocalizedMessagerequiredDone face; announced
errorLabelLocalizedMessagerequiredError face; announced
retryLabelLocalizedMessagerequiredRetry button on the error face
undoLabelLocalizedMessagenoneUndo button on the done face; required with onUndo, not allowed without it
onUndo() => Promise<unknown> | unknownnoneCalled when Undo is pressed
onConfirm() => Promise<unknown> | unknownrequiredRuns on Confirm and Retry
onCancel() => voidnoneThe prompt was cancelled
onConfirmError(error: unknown) => voidnoneonConfirm or onUndo rejected
toneConfirmMorphToneNeutralNeutral or Destructive
sizeButtonSizeLargeControl height; the buttons on other faces are Small
leadingReactNodenoneContent before the trigger label
disabledbooleanfalseDisables the trigger
idstringnoneRoot id
classNamestringnoneClass on the root
refRef<HTMLDivElement>noneRef to the root
Exported from the component: ConfirmMorph, ConfirmMorphTone, and the types ConfirmMorphOwnProps, ConfirmMorphProps, and ConfirmMorphUndoProps.
Props
NameTypeDefaultDescription
cancelLabelLocalizedMessage—Label of the Cancel button.
confirmLabelLocalizedMessage—Label of the Confirm button.
doneLabelLocalizedMessage—Label on the done face. Announced when the face appears.
errorLabelLocalizedMessage—Label on the error face. Announced when the face appears.
labelLocalizedMessage—Label of the trigger on the idle face.
onConfirm() => unknown—Runs when Confirm or Retry is pressed. The control is pending until the returned promise settles: a resolved promise shows the done face, a rejected one (or a synchronous throw) shows the error face. A synchronous return counts as resolved. @returns A promise to wait for, or nothing
pendingLabelLocalizedMessage—Label on the pending face. Announced when the face appears.
promptLocalizedMessage—Prompt on the confirming face. Announced when the face appears.
retryLabelLocalizedMessage—Label of the Retry button on the error face.
classNamestring—Classes appended after the generated classes. Put overrides in @layer chroma.overrides.
disabledbooleanfalseDisables the trigger. Has no effect once the prompt is open.
idstring—Element id of the root.
leadingReactNode—Content before the trigger label, usually an Icon.
onCancel(() => void)—Called when the prompt is cancelled by Cancel, Escape, a press outside, or its timeout.
onConfirmError((error: unknown) => void)—Called with whatever onConfirm rejected or threw, or onUndo rejected with, after the face has changed. @param error - The rejection reason
onUndo(() => unknown)—Called when Undo is pressed. The control returns to idle at once; a rejection is reported to onConfirmError. @returns Anything; a promise is observed for rejection only
refRef<HTMLDivElement>—Ref to the root element.
sizeButtonSizeButtonSize.LargeHeight of the control. The buttons on the other faces are Small and sit inside it.
toneConfirmMorphToneConfirmMorphTone.NeutralEmphasis.
undoLabelLocalizedMessage—Label of the Undo button on the done face.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Confirm Morph / Usage
Next
Confirm Morph / Accessibility
On this page
Props
Storybook