# Deleting and other confirmed actions

An action that can't be undone, or that Firm Pilot must not take alone: deleting, sending, converting to a matter, anything that bills.

## When it applies

- The action can't be undone, like deleting a record or discarding unsaved edits.
- The action is one an agent must not do without the lawyer: delete, send, convert to a matter, or anything that bills.

## Components

- [Dialog](../components/dialog.md): `AlertDialog`, which asks before the action runs.
- [Button](../components/button.md): The confirming button, `destructive` for a delete.
- [Toast](../components/toast.md): Says what happened, with Undo when it can be reversed.

## Rules

- Do: Ask with `AlertDialog`. Write `AlertDialogTitle` as a question, like Delete record?, say what happens in `AlertDialogDescription`, and name the confirming button with the action, like Delete.
- Do: Put `data-agent-confirm="<what it does>"` on the confirming button in the footer, not on the trigger.
- Do: Give a change that can be reversed an `action` on its toast, like Undo.
- Do: Let closing return focus on its own. Pass `finalFocus` only when the control that opened the dialog is gone, like the row a delete removed.
- Don't: Add a close button to an `AlertDialog`, or let a press outside close it. Its choice is in the footer.
- Don't: Use a `Drawer` to ask. A quick question or a confirmation is a `Dialog`, or an `AlertDialog` for a choice that can't be undone.

## See it

- [List page](../screens/example-list-page.md): A page that is a list: one toolbar under the header with views, search and a filter, and a table that fills the rest of the window edge to edge.
- [Form panel](../screens/example-form-panel.md): A form in a panel over the list: fields in one column, pairs side by side, and Cancel and Save in the panel's footer.
