AlertDialog
A confirmation dialog with cancel and action buttons.
Import
import { AlertDialog } from "@tarve/core";Usage
import { AlertDialog, Button } from "@tarve/core";
let open = true;
<>
<Button variant="destructive" onClick={() => (open = true)}>
Delete project
</Button>
<AlertDialog
open={open}
title="Delete project?"
description="This action cannot be undone."
actionLabel="Delete"
actionVariant="destructive"
onAction={() => console.log("deleted")}
onOpenChange={(next) => {
open = next;
}}
/>
</>Props
| Prop | Type | Default |
|---|---|---|
open required | boolean | — |
title required | string | — |
actionDisabled | boolean | — |
actionLabel | string | "Continue" |
actionVariant | ButtonProps["variant"] | "default" |
cancelLabel | string | "Cancel" |
closeOnEscape | boolean | false |
description | string | — |
onAction | () => void | — |
onCancel | () => void | — |
onOpenChange | (open: boolean) => void | — |
Common props
Shared by every component. See descriptions →
childrenclassclassNamehighlightidkeymotionFromonHighlightonPasteonPointerLeaveonPointerMoveonSizeonTransitionEndrovingGroupstyleTypes
interface ButtonProps extends BaseProps {
variant?: ButtonVariant;
size?: "sm" | "default" | "lg";
disabled?: boolean;
control?: Control;
onClick?: () => void;
onHover?: (hovered: boolean) => void;
/**
* Liquid Glass capsule: `true`, a variant or options. `destructive` tints it red,
* `ghost` is clear glass without a shadow, `glass={{ tint }}` makes a prominent coloured one.
*/
glass?: GlassProp;
}