Actions

Danger zone

A red box with a warning and a Delete button that asks for confirmation in a dialog before running a destructive action. Use it at the end of a settings or edit page, for deleting the record, closing the account and the like.

Danger Zone

By deleting this record, all associated data will be permanently lost and cannot be recovered.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Last action: —
Blade

A red box titled "Danger Zone", with a message saying the record and its data will be lost for good, and a red Delete button under it. Delete opens a dialog asking "Do you really want to delete this record?" with Cancel and Confirm; Confirm calls deleteAccount and closes the dialog, Cancel or Escape closes it without doing anything. Every default text is translated.

Your own texts #

title and message change the box. trigger: reaches the Delete button, here with another label and an icon. modal: reaches the dialog: its title, the subtitle under it, and the confirm button through modal:confirm:, whose label stays "Confirm" unless you change it.

Delete project

The project, its tasks and its files are removed for everyone.

Delete this project?

Its 12 tasks go with it.

Last action: —
Blade

Your own content #

Content in the default slot takes the place of the Delete button and the dialog: the box shows the title, the message and the two buttons, and nothing asks for confirmation.

Close account

You can export your data before closing the account.

Export data
Last action: —
Blade

Rendering from data #

One box per project, each with its own dialog. Confirming in the second box calls deleteProject(2).

Delete Website redesign

By deleting this record, all associated data will be permanently lost and cannot be recovered.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Delete Mobile app

By deleting this record, all associated data will be permanently lost and cannot be recovered.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Last action: —
Blade

Message as a list #

An array in message renders as a list, useful to spell out what will be lost.

Delete workspace

  • All projects and tasks are removed.
  • Members lose access immediately.
  • Invoices stay available for 30 days.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Blade

Alert styles #

The box is a tk:alert: type, variant, border and size pass to it, and trigger:variant changes the button.

Transfer ownership

You will lose admin rights over this organization.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Revoke all sessions

Every device is signed out.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Blade

Prepend and actions #

The prepend slot goes before the title and actions at the end of the row.

Admin only

Archive repository

The repository becomes read-only for everyone.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Blade

Events #

confirmed bubbles from the confirm button, so it can be heard on the tag with Alpine.

Remove integration

The Slack integration stops sending messages.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Integration removed.

Blade

Customization #

Classes go to the box; title:, trigger: and modal: reach the parts. With modal:auto-close bound to false the dialog stays open after Confirm until the action closes it.

Danger Zone

By deleting this record, all associated data will be permanently lost and cannot be recovered.

Do you really want to delete this record?

This action is permanent and cannot be undone. All related data will be lost.

Blade

Reference

Danger zone

Prop Type Default Description
title string Danger Zone The heading of the box, translated.
message string | array By deleting this record, all associated data will be permanently lost and cannot be recovered. The text under the title, translated. An array renders as a list.
prepend slot null Content before the title.
actions slot null Controls at the end of the row.

The box is a tk:alert, and the other alert props pass to it (type, variant, icon, border, closable, size...); type defaults to danger.

Slots

Slot Description
default Replaces the Delete button and the dialog.
prepend Content before the title.
actions Controls at the end of the row.

Events

Event Detail When
confirmed The confirm button of the dialog was clicked.

Prefixes

Prefix Goes to
trigger: The Delete button, as props and attributes of tk:button (trigger:label, trigger:icon, trigger:size...).
modal: The dialog, as props and attributes of tk:modal.confirm: modal:title, modal:subtitle, modal:confirm (the Livewire action), modal:cancel, modal:name, and its own prefixes modal:confirm:, modal:cancel: and modal:actions:.
title:, message:, icon:, container:, actions:, close: The parts of the box, as in tk:alert.

Events

The event bubbles from the confirm button through the box, so it can be heard on the tag or on any element around it.

The dialog's own opened and closed do not reach the tag. With closable, the box dispatches the alert events (before-dismiss, dismissed).

With Alpine:

blade

Calling a Livewire action:

blade

Customization

Classes and attributes go to the box, the root element of the alert. To reach an inner element, prefix the attribute (listed in the Reference above).

blade

The box gets a thick red border on the left and its title is an <h2>. With :modal:auto-close="false" the dialog stays open after Confirm, so the action can close it when it is done; the bound form is needed, since the string "false" keeps it closing.

Accessibility

The box has role="group" and aria-labelledby pointing to its title, and aria-live="off": unlike a tk:alert of type danger, it is part of the page and is not announced when the page loads. Pass role to change it.

The dialog follows the WAI-ARIA alert dialog pattern: role="alertdialog", named by its title and described by its subtitle. When it opens the focus goes to Cancel, so pressing Enter by accident does not confirm; when it closes the focus returns to the Delete button.

Key Action
Enter, Space On the Delete button, opens the dialog.
Tab Moves from Cancel to Confirm.
Enter Runs the focused button: Cancel closes the dialog, Confirm runs the action and closes it.
Escape Closes the dialog without confirming.

Behavior notes

  • The box and the Delete button are red by default; type and trigger:variant change them.
  • title and message take only strings. A title or message slot is ignored, and the default text shows in its place.
  • modal: and trigger: attributes do nothing when the default slot has content, since there is no dialog or button to receive them.
  • The confirm button is red, but its label is "Confirm" (translated); pass modal:confirm:label for a label that names the action.
  • The title id is the tag's id followed by -title, or a generated one when there is no id.
  • Inside Livewire the Delete button still opens its dialog after an update, and each box in a @foreach keeps its own dialog.