Alert dialog trigger
In code: AlertDialogTrigger
A part of Alert dialog: use it inside one.
The button that opens an AlertDialog; it keeps its usual look while the question is open
Preview
Use
The code of the preview above
import {
AlertDialog,
AlertDialogClose,
AlertDialogContent,
AlertDialogTrigger,
Button,
toast,
} from '@/components/ui';
<AlertDialog>
<AlertDialogTrigger render={<Button variant="danger" />}>Delete booking</AlertDialogTrigger>
<AlertDialogContent title="Delete Noor Haddad's booking?" description="Friday 09:30 opens up for others. This cannot be undone.">
<AlertDialogClose render={<Button variant="ghost" />}>Keep it</AlertDialogClose>
<AlertDialogClose
value="confirm"
render={<Button variant="danger" />}
data-agent-confirm="Deletes Noor Haddad's booking"
afterClose={() => toast.success({ title: 'Booking deleted' })}
>
Delete forever
</AlertDialogClose>
</AlertDialogContent>
</AlertDialog>Options
No options of its own.
It also takes the 292 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.
Without React
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/card.csscomponents/tabs.csscomponents/dialog.csscomponents/tab-bar.csscomponents/prose.csscomponents/page-transitions.cssparts/carousel.cssparts/board.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
Drafted
Sent to Kestrel Studio
Opened by the client
On top of the page: states, do and don’t
States. Closed, opening (fades and rises), open, closing (fades before what it changed appears: afterClose). While open, focus is inside and Escape closes it; when it closes, focus goes back to what opened it.
Do
- Name every dialog, drawer and popover (
DialogTitle,DrawerTitle, oraria-label). - Use
AlertDialogfor anything that cannot be undone, with the action named on its button ("Delete 3 files"). - Use a
Draweron a phone for what aPopoverdoes on a computer.
Don't
- Don't open a dialog from a dialog; change what the open one shows instead.
- Don't put the only way to do something in a right-click menu or a tooltip.
- Don't use a toast for something the person must not miss: that is an
Alerton the page.