Sign out confirmation
Confirm a wide-impact action that is not destructive. The action repeats the verb and Cancel names the safe outcome.
"use client"
import * as React from "react"
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button"
export function AlertDialogSignOutConfirmation() {
const [revokeOpen, setRevokeOpen] = React.useState(false)
const [revoking, setRevoking] = React.useState(false)
function revokeAccess(event: React.MouseEvent) {
// Keep the dialog open while the work runs; close it from the parent when it ends.
event.preventDefault()
setRevoking(true)
window.setTimeout(() => {
setRevoking(false)
setRevokeOpen(false)
}, 1200)
}
return (
<div className="flex flex-wrap items-center gap-3">
<AlertDialog>
<AlertDialogTrigger asChild>
<Button intent="neutral" emphasis="stroke">
Sign out everywhere
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Sign out of all devices?</AlertDialogTitle>
<AlertDialogDescription>
Every active session ends, including this one. You can sign in
again at any time.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel asChild>
<Button intent="neutral" emphasis="stroke">
Stay signed in
</Button>
</AlertDialogCancel>
<AlertDialogAction asChild>
<Button>Sign out</Button>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
)
}