shadimage
corr
componentaction-dialogsource: ok · hit

Dialog

A compact dialog wrapper for focused confirmation and form actions.

npx shadcn add "https://ui.corr.sh/r/action-dialog.json"
free

Interaction

modal

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light

Registry dependencies

buttondialog

Files1 · source cached 10/9/2026, 8:13:22 AM

registry/corr/components/action-dialog.tsx
import type { ReactNode } from "react"

import { Button } from "@/components/ui/button"
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"

export function ActionDialog({
  trigger,
  title,
  description,
  children,
  actionLabel = "Continue",
  cancelLabel = "Cancel",
  size = "default",
  formId,
  onAction,
}: {
  trigger: ReactNode
  title: string
  description?: string
  children?: ReactNode
  actionLabel?: string
  cancelLabel?: string
  size?: "sm" | "default" | "lg"
  formId?: string
  onAction?: () => void
}) {
  const sizeClassName =
    size === "sm"
      ? "sm:max-w-sm"
      : size === "lg"
        ? "sm:max-w-2xl"
        : "sm:max-w-md"

  return (
    <Dialog>
      <DialogTrigger asChild>{trigger}</DialogTrigger>
      <DialogContent className={sizeClassName}>
        <DialogHeader>
          <DialogTitle>{title}</DialogTitle>
          {description ? (
            <DialogDescription>{description}</DialogDescription>
          ) : null}
        </DialogHeader>
        {children ? <div className="py-2 text-sm">{children}</div> : null}
        <DialogFooter className="gap-2 sm:justify-end">
          <DialogClose asChild>
            <Button type="button" variant="outline">
              {cancelLabel}
            </Button>
          </DialogClose>
          <DialogClose asChild>
            <Button
              type={formId ? "submit" : "button"}
              form={formId}
              onClick={formId ? undefined : onAction}
            >
              {actionLabel}
            </Button>
          </DialogClose>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  )
}

More from corr

Browse all components in this library →