Skip to content

Confirm dialog

Forms
Confirm dialog
Delete state machine?

This will permanently remove checkout and all 14 connected effects.

Destructive action confirmation — title, description, typed confirmation input, and danger/cancel buttons.

card · field · input · checkbox · button
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/card"
import { Stack } from "@/components/ui/stack"
import { Field, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { Checkbox } from "@/components/ui/checkbox"
import { Button } from "@/components/ui/button"

export function ConfirmDialog() {
  return (
    <Card className="max-w-sm">
      <CardHeader><CardTitle>Delete state machine?</CardTitle></CardHeader>
      <CardContent>
        <Stack direction="col" gap="4">
          <p className="text-sm text-muted-foreground">This will permanently remove checkout and all 14 connected effects.</p>
          <Field>
            <FieldLabel>Type 'checkout' to confirm</FieldLabel>
            <Input placeholder="checkout" />
          </Field>
          <Field orientation="horizontal">
            <Checkbox />
            <FieldLabel>I understand this cannot be undone.</FieldLabel>
          </Field>
        </Stack>
      </CardContent>
      <CardFooter className="justify-end gap-2">
        <Button variant="ghost">Cancel</Button>
        <Button variant="destructive">Delete machine</Button>
      </CardFooter>
    </Card>
  )
}
ui26/react
<script lang="ts">
  import Card from "$lib/components/ui/card.svelte"
  import CardHeader from "$lib/components/ui/card-header.svelte"
  import CardTitle from "$lib/components/ui/card-title.svelte"
  import CardContent from "$lib/components/ui/card-content.svelte"
  import Stack from "$lib/components/ui/stack.svelte"
  import Field from "$lib/components/ui/field.svelte"
  import FieldLabel from "$lib/components/ui/field-label.svelte"
  import Input from "$lib/components/ui/input.svelte"
  import Checkbox from "$lib/components/ui/checkbox.svelte"
  import CardFooter from "$lib/components/ui/card-footer.svelte"
  import Button from "$lib/components/ui/button.svelte"
</script>

<Card class="max-w-sm">
  <CardHeader><CardTitle>Delete state machine?</CardTitle></CardHeader>
  <CardContent>
    <Stack direction="col" gap="4">
      <p class="text-sm text-muted-foreground">This will permanently remove checkout and all 14 connected effects.</p>
      <Field>
        <FieldLabel>Type 'checkout' to confirm</FieldLabel>
        <Input placeholder="checkout" />
      </Field>
      <Field orientation="horizontal">
        <Checkbox />
        <FieldLabel>I understand this cannot be undone.</FieldLabel>
      </Field>
    </Stack>
  </CardContent>
  <CardFooter class="justify-end gap-2">
    <Button variant="ghost">Cancel</Button>
    <Button variant="destructive">Delete machine</Button>
  </CardFooter>
</Card>
ui26/svelte
---
import Card from "@/components/ui/card.astro"
import CardHeader from "@/components/ui/card-header.astro"
import CardTitle from "@/components/ui/card-title.astro"
import CardContent from "@/components/ui/card-content.astro"
import Stack from "@/components/ui/stack.astro"
import Field from "@/components/ui/field.astro"
import FieldLabel from "@/components/ui/field-label.astro"
import Input from "@/components/ui/input.astro"
import Checkbox from "@/components/ui/checkbox.astro"
import CardFooter from "@/components/ui/card-footer.astro"
import Button from "@/components/ui/button.astro"
---

<Card class="max-w-sm">
  <CardHeader><CardTitle>Delete state machine?</CardTitle></CardHeader>
  <CardContent>
    <Stack direction="col" gap="4">
      <p class="text-sm text-muted-foreground">This will permanently remove checkout and all 14 connected effects.</p>
      <Field>
        <FieldLabel>Type 'checkout' to confirm</FieldLabel>
        <Input placeholder="checkout" />
      </Field>
      <Field orientation="horizontal">
        <Checkbox />
        <FieldLabel>I understand this cannot be undone.</FieldLabel>
      </Field>
    </Stack>
  </CardContent>
  <CardFooter class="justify-end gap-2">
    <Button variant="ghost">Cancel</Button>
    <Button variant="destructive">Delete machine</Button>
  </CardFooter>
</Card>
ui26/astro
{
  "root": "card",
  "elements": {
    "card": {
      "type": "Card",
      "props": {
        "className": "max-w-sm"
      },
      "children": [
        "hdr",
        "content",
        "footer"
      ]
    },
    "hdr": {
      "type": "CardHeader",
      "props": {},
      "children": [
        "title"
      ]
    },
    "title": {
      "type": "CardTitle",
      "props": {
        "text": "Delete state machine?"
      },
      "children": []
    },
    "content": {
      "type": "CardContent",
      "props": {},
      "children": [
        "body-stack"
      ]
    },
    "body-stack": {
      "type": "Stack",
      "props": {
        "direction": "col",
        "gap": "4"
      },
      "children": [
        "body",
        "fld",
        "agree"
      ]
    },
    "body": {
      "type": "Text",
      "props": {
        "content": "This will permanently remove checkout and all 14 connected effects.",
        "size": "sm",
        "muted": true
      },
      "children": []
    },
    "fld": {
      "type": "Field",
      "props": {},
      "children": [
        "lbl",
        "inp"
      ]
    },
    "lbl": {
      "type": "FieldLabel",
      "props": {
        "text": "Type 'checkout' to confirm"
      },
      "children": []
    },
    "inp": {
      "type": "Input",
      "props": {
        "placeholder": "checkout"
      },
      "children": []
    },
    "agree": {
      "type": "Field",
      "props": {
        "orientation": "horizontal"
      },
      "children": [
        "chk",
        "aglbl"
      ]
    },
    "chk": {
      "type": "Checkbox",
      "props": {},
      "children": []
    },
    "aglbl": {
      "type": "FieldLabel",
      "props": {
        "text": "I understand this cannot be undone."
      },
      "children": []
    },
    "footer": {
      "type": "CardFooter",
      "props": {
        "className": "justify-end gap-2"
      },
      "children": [
        "cancel",
        "del"
      ]
    },
    "cancel": {
      "type": "Button",
      "props": {
        "label": "Cancel",
        "variant": "ghost"
      },
      "children": []
    },
    "del": {
      "type": "Button",
      "props": {
        "label": "Delete machine",
        "variant": "destructive"
      },
      "children": []
    }
  }
}
ui26/json-render