Skip to main content

Confirming deletion

WhatHow
Files, cards, recordingsinto the trash without asking, plus a toast "Moved to the trash"
Permanently from the trashConfirmDialog
A whole course, removing a member, leaving a courseConfirmDialog with danger
Your own accounta page of its own: type in your email address to confirm
Result
Loading...
Live Editor
function Example() {
  const [ask, setAsk] = useState(false);
  return (
    <>
      <Button variant="danger" icon="logout" onClick={() => setAsk(true)}>Leave course</Button>
      {ask && (
        <ConfirmDialog title="Leave Control Engineering?" confirm="Leave" danger onClose={() => setAsk(false)} onConfirm={() => toast("You left the course")}>
          You will no longer see its files and notes. A member can invite you again.
        </ConfirmDialog>
      )}
      <Toaster />
    </>
  );
}

Rules​

  • The title is a question with the name of what disappears.
  • The text says what happens afterwards, and whether it comes back.
  • The button repeats the verb: "Delete", "Leave", "Remove" – never "Yes".
  • "Cancel" has the focus.