Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Blocks
  2. Required Action Dialog
  3. API and Development

Required Action Dialog

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import RequiredActionDialog, RequiredActionDialogBehavior and RequiredActionIntent from @prepared911/ui/blocks/required-action-dialog. The declaration in packages/ui/src/blocks/required-action-dialog/schema.ts is the contract for inputs and composed components; prop types and TSDoc are in packages/ui/src/blocks/required-action-dialog/props.ts.
PropTypeDefault
openboolean, required. Only the host changes it
titleLocalizedMessage, required
descriptionLocalizedMessage, required
primaryActionRequiredAction, required in both behaviors
secondaryActionsreadonly RequiredAction[], placed before the primarynone
behaviorRequiredActionDialogBehavior: Dismissible or Forced. Forced is the rare exceptionDismissible
closeLabelLocalizedMessage, required when Dismissible; rejected when Forced
onOpenChange(open: false, details) => void, Dismissible only; reasons close-press, close-requestnone
errorCodeDisplayValue; needs errorCodeLabelsnone
errorCodeLabelsRequiredActionErrorCodeLabels; needs errorCodenone
A RequiredAction is { label: LocalizedMessage; onPress: () => void | Promise<void>; intent?: RequiredActionIntent }. RequiredActionIntent is Default or Destructive (only for an action that is itself irreversible). Forced is the rare exception, for a condition the person cannot safely continue past (for example a forced logout). Dismissible is the default and the right choice unless there is no safe way to continue. Never use Forced to make an ordinary notification harder to ignore; the host owns closing it, so it must always provide a way to complete the required action.
Props
NameTypeDefaultDescription
descriptionLocalizedMessage—What happened and what the person must do. Describes the dialog.
openboolean—Whether the dialog is shown. Only the host changes it, in both behaviors: a close request is reported, never applied, and there is no defaultOpen or trigger.
primaryActionRequiredAction—The action the person is expected to take, required in both behaviors. It takes initial focus and sits last, at the inline end.
titleLocalizedMessage—Heading that names the dialog. Always visible.
behaviorRequiredActionDialogBehaviorRequiredActionDialogBehavior.DismissibleThe default and the right choice unless there is no safe way to continue. Set {@link RequiredActionDialogBehavior.Forced} only for the rare condition the person cannot safely continue past. The rare exception, for a condition the person cannot safely continue past, such as a forced logout. It must not be used to make an ordinary notification harder to ignore. The host owns closing it, so it must always provide a way to complete the required action. Use the default {@link RequiredActionDialogBehavior.Dismissible} otherwise.
closeLabelLocalizedMessage—Accessible name of the header close control, such as "Close". The control shows only an icon. Absent in this behavior: there is no close control to name.
errorCodeDisplayValue—Absent in this shape: an error code comes with its labels, or neither is set. A code the person can read out to support. Data, not copy: shown as written, with a copy button.
errorCodeLabelsRequiredActionErrorCodeLabels—Absent in this shape: error code labels come with an error code, or neither is set. The visible and accessible copy for the error code row.
onOpenChange((open: false, details: DialogOpenChangeDetails) => void)—Called when the person closes the dialog without acting: close-press for the close control, close-request for Escape. The dialog stays open until the host sets open to false. The action is still required: the host decides when the dialog comes back. Absent in this behavior: the person cannot close the dialog, so there is nothing to report.
secondaryActionsreadonly RequiredAction[]—Other ways forward, in reading order before the primary action. Omit it when there is one way forward.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
Required Action Dialog / Usage
Next
Required Action Dialog / Accessibility
On this page
Props
Storybook