Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Destructive confirm

Set the danger tone for anything that removes or destroys data, so the weight of the action is unmistakable.

Confirm a delete
Show code
<app-button tone="Danger" data-bs-toggle="modal" data-bs-target="#scDeleteConfirm">Delete project</app-button>
<app-confirm-dialog id="scDeleteConfirm"
    title="Delete this project?"
    description="Assessments and reports attached to it will be removed. This cannot be undone."
    confirm-label="Delete"
    tone="danger"></app-confirm-dialog>

Type to confirm

Use a typed phrase for the highest-stakes actions, so Confirm stays locked until the exact text is entered.

Require a typed phrase
Show code
<app-button tone="Danger" data-bs-toggle="modal" data-bs-target="#scWipeConfirm">Delete workspace</app-button>
<app-confirm-dialog id="scWipeConfirm"
    title="Delete workspace?"
    description='Type "acme-corp" to confirm.'
    confirm-phrase="acme-corp"
    confirm-label="Delete forever"
    tone="danger"></app-confirm-dialog>

Neutral and plain

Leave the danger tone off for a reversible action, and use plain for a quick confirm inside a working screen.

A non-destructive confirm
Show code
<app-button data-bs-toggle="modal" data-bs-target="#scArchiveConfirm">Archive report</app-button>
<app-confirm-dialog id="scArchiveConfirm"
    title="Archive this report?"
    description="You can restore it later from the archive tab."
    confirm-label="Archive"></app-confirm-dialog>
Remove from a list
Show code
<app-button variant="Soft" data-bs-toggle="modal" data-bs-target="#scPlainConfirm">Remove item</app-button>
<app-confirm-dialog id="scPlainConfirm"
    title="Remove this item?"
    description="It leaves the list. You can add it again later."
    confirm-label="Remove"
    cancel-label="Keep"
    variant="plain"></app-confirm-dialog>

Illustration and icon size

Use your own artwork when the tone artwork does not fit, and set a pixel size to resize the badge.

Your artwork, the library's footprint
Show code
<app-button data-bs-toggle="modal" data-bs-target="#scImageBigConfirm">Open with a 512px source</app-button>
<app-button variant="Outline" data-bs-toggle="modal" data-bs-target="#scImageSmallConfirm">Open with a 40px source</app-button>
<app-confirm-dialog id="scImageBigConfirm"
    title="Upgrade to Team?"
    description="Everyone in your workspace gets the shared library."
    image="/art/upgrade.svg"
    confirm-label="Upgrade"></app-confirm-dialog>
<app-confirm-dialog id="scImageSmallConfirm"
    title="Add this to your favourites?"
    description="It will show up at the top of the sidebar."
    image="/art/favourite.svg"
    confirm-label="Add"></app-confirm-dialog>
Badge size in pixels
Show code
<app-button variant="Outline" data-bs-toggle="modal" data-bs-target="#scIconSmallConfirm">Archive report</app-button>
<app-confirm-dialog id="scIconSmallConfirm"
    title="Archive this report?"
    description="You can restore it from the archive later."
    tone="warning"
    icon-size="48"
    confirm-label="Archive"></app-confirm-dialog>

Loading

Set loading while the confirmed action runs, so Confirm and Cancel lock and the dialog stays open.

A busy confirm
Show code
<app-button tone="Danger" data-bs-toggle="modal" data-bs-target="#scLoadingConfirm">Delete project</app-button>
<app-confirm-dialog id="scLoadingConfirm"
    title="Delete this project?"
    description="Assessments and reports attached to it will be removed. This cannot be undone."
    confirm-label="Delete"
    tone="danger"
    loading="true"></app-confirm-dialog>

Ask from anywhere

Ask a yes or no question from any part of the page, without placing a dialog in the markup.

Remove from any component
Show code
<app-button tone="Danger"
    data-wui-confirm="It leaves the list."
    data-wui-confirm-title="Remove this item?"
    data-wui-confirm-label="Remove"
    data-wui-confirm-tone="danger">Remove item</app-button>

Every option

Every value of every prop, one cell each.

id and open: how the dialog shows

open (React only): true while the dialog shows, set by the trigger
id: a trigger opens the dialog by naming this id

title: the dialog heading

title="Delete this project?"

description: the consequence text

description="It leaves the list."

variant: default or plain

variant="default" (default)
variant="plain"

confirm and cancel labels: custom copy

confirm-label="Delete forever"
cancel-label="Never mind"

tone: every value

tone="success"
tone="danger"
tone="warning"
tone="info"
tone="primary"
tone unset (default): the info icon
unknown tone: not a tone, so the valid set is the five above
Valid tones: success, danger, warning, info, primary

icon: replaces the tone glyph

icon="trash"
icon="log-out"
icon="warning-2"
icon as a node (React only): a node is drawn as given

iconSize: illustration size in px

icon-size="48"
icon-size unset (default): 120px with a message

image: any source size, one footprint

image (512px source)
image (40px source)
image, no message
image + tone danger

confirmPhrase: type-to-confirm gate

confirm-phrase="acme-corp" (locked until typed)

typePhraseLabel: the built-in text, replaced

type-phrase-label (default): "Type {phrase} to confirm"
type-phrase-label="Saisissez {phrase} pour confirmer"

loading, static backdrop and placement

loading="true" (spinner, everything locked)
static-backdrop="true" (default): a backdrop click and Escape leave it open
static-backdrop="false": a backdrop click and Escape close it
placement="center" (default)
placement="top"

size: card width (preset or custom px)

size="sm"
size="md" (default)
size="lg"
size="xl"
size="720" (custom px)

confirm href: the confirm button as a link

confirm-href="#": the confirm button links to a URL

onConfirm and onClose: what runs on confirm and dismiss

onConfirm (React only): Razor's confirm button carries data-app-confirm to wire up
onClose (React only): Razor's Cancel closes the dialog

className: extra classes on the dialog

className (React only): merged onto the dialog's own classes

Guidance

What to do, and what to avoid.

Use it when

  • A destructive action needs a deliberate second step: delete, remove, cancel.
  • An action is irreversible and you want the user to pause before it runs.
  • The stakes are high enough to warrant typing an exact phrase to unlock (confirmPhrase).

Reach for something else when

  • The dialog holds a form or details, not a yes/no question. → AppModal
  • The action is trivial and easily undone. → an inline action + undo toast
  • You're confirming across a slide-in panel of options. → AppDrawer

Name the verb and use danger

Do

The danger tone + a verb-labelled button ("Delete") makes the weight and the outcome of the action clear.

Avoid

A neutral "OK" on a destructive confirm hides what pressing it actually does.

Typed name only for irreversible actions

Do

For an account-wide wipe, confirmPhrase forces the user to type the name, so there are no accidental clicks.

Avoid

Gating a reversible archive behind a typed phrase is friction with no payoff, so save it for the irreversible.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

(none) success danger warning info primary
(none) trash log-out warning-2
default plain
none (tone artwork) a 512px source a 40px source
center top
sm md lg xl
(none) 480 720
React, generated from the controls
<AppConfirmDialog
  open={open}
  title="Delete this project?"
  description="Assessments and reports attached to it will be removed."
  size="sm"
  onConfirm={() => setOpen(false)}
  onClose={() => setOpen(false)}
/>
Razor, the same props
<app-confirm-dialog id="pgConfirm" title="Delete this project?" description="Assessments and reports attached to it will be removed." size="Sm" />

18 props. The 4 most used come first.

Used on most screens 4 props

PropTypeDefaultDescription
titledefault - string - The dialog heading.
descriptiondefault - string - The consequence: what happens if the user confirms. Inner content overrides it.
confirm-labeldefault Confirm string Confirm The confirm button's text.
tonedefault - Success | Danger | Warning | Info | Primary - The status icon, and the confirm button's colour when danger: the danger tone styles Confirm as destructive and draws the delete icon. Unset, the icon is info.

Less common 14 props

PropTypeDefaultDescription
iddefault - string - The dialog id. A trigger button opens the dialog when it names this id.
cancel-labeldefault Cancel string Cancel The cancel button's text.
confirm-hrefdefault - string - If set, the confirm button is a link to this URL; otherwise a plain button carrying data-app-confirm to wire up.
icondefault - string - Replaces the tone's glyph with the named icon. An image still wins over it.
icon-sizedefault - int - Width and height of the illustration in px, for the tone artwork and a custom image alike. Unset, it is 120px with a message and 84px without.
imagedefault - string - URL of a custom illustration that replaces the tone artwork. Any source size is fine: the theme boxes it to the same footprint. It is decorative, so the title and message carry the meaning.
variantdefault default Default | Plain default default keeps the status illustration and equal-width actions. plain drops the illustration, starts the text at the edge and sizes the actions small, right-aligned.
confirm-phrasedefault - string - Exact text the user must type before Confirm unlocks, such as a workspace name.
type-phrase-labeldefault Type {phrase} to confirm string Type {phrase} to confirm Replaces the built-in English text, for other languages. {phrase} is filled with the confirm phrase.
loadingdefault false bool false Busy state: shows a spinner and disables Confirm, Cancel and the confirm-phrase field, and blocks dismissal while the async action is in flight.
static-backdropdefault true bool true The dialog closes only through its own Cancel or Confirm by default. false lets Escape and an outside click close it.
placementdefault center Center | Top center Vertical placement of the card: centred, or pinned near the top.
sizedefault md Sm | Md | Lg | Xl md Card width: a preset.
size-pxdefault - number - The card width in px, instead of a preset.

Screen reader

6 notes
  • The dialog is built on AppModal, so it traps focus, closes on Escape only when staticBackdrop is false, and restores focus.
  • The title is an h3 that takes focus when the dialog opens.
  • A custom image is hidden from assistive technology with an empty alt, so the title and message carry the meaning.
  • The confirm-phrase field is named "Type <phrase> to confirm", and Confirm stays disabled until the phrase matches.
  • While loading, Cancel is disabled and the backdrop and Escape no longer close the dialog.
  • Children draw left-aligned between the description and the confirm-phrase field, so a field placed there keeps its own label.

Do and avoid

2 pairs

Name the verb and use danger

Do

The danger tone + a verb-labelled button ("Delete") makes the weight and the outcome of the action clear.

Avoid

A neutral "OK" on a destructive confirm hides what pressing it actually does.

Typed name only for irreversible actions

Do

For an account-wide wipe, confirmPhrase forces the user to type the name, so there are no accidental clicks.

Avoid

Gating a reversible archive behind a typed phrase is friction with no payoff, so save it for the irreversible.