ConfirmationCard
fable-ui/confirmation-cardFreeComponent
Request explicit user confirmation before the host app performs a side effect.
Live preview
live · rendered by the registry
Rendered by fable-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://fable-ui.shobky.com/r/confirmation-card.jsonSource
1"use client"23import { Badge } from "@/components/ui/badge"4import { Button } from "@/components/ui/button"5import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"6import { cn } from "@/lib/utils"78export type ConfirmationVariant = "default" | "warning" | "destructive"910export type ConfirmationCardProps = {11 id: string12 title: string13 description: string14 confirmLabel?: string15 cancelLabel?: string16 variant?: ConfirmationVariant17 details?: string[]18 isLoading?: boolean19 isDisabled?: boolean20 error?: {21 title: string22 description?: string23 }24 onConfirm?: (confirmation: { id: string; label: string }) => void25 onCancel?: (confirmation: { id: string; label: string }) => void26}2728export function ConfirmationCard({29 id,30 title,31 description,32 confirmLabel = "Confirm",33 cancelLabel = "Cancel",34 variant = "default",35 details = [],36 isLoading,37 isDisabled,38 error,39 onConfirm,40 onCancel,41}: ConfirmationCardProps) {42 const isDestructive = variant === "destructive"4344 return (45 <Card className="w-full max-w-xl" data-fable-ui="confirmation-card" aria-busy={isLoading || undefined}>46 <CardHeader>47 <div className="flex items-start justify-between gap-3">48 <div className="flex flex-col gap-1">49 <CardTitle className="text-base">{title || "Confirm action"}</CardTitle>50 <CardDescription>{description}</CardDescription>51 </div>52 <Badge variant={isDestructive ? "destructive" : "secondary"}>{variant}</Badge>53 </div>54 </CardHeader>55 <CardContent className="flex flex-col gap-3">56 {isLoading ? <p className="text-sm text-muted-foreground">Preparing confirmation...</p> : null}57 {error ? (58 <div className="rounded-md border border-destructive/20 bg-destructive/5 p-3">59 <p className="text-sm font-medium text-destructive">{error.title}</p>60 {error.description ? <p className="text-sm text-muted-foreground">{error.description}</p> : null}61 </div>62 ) : null}63 {details.length > 0 ? (64 <ul className="flex flex-col gap-2 text-sm text-muted-foreground">65 {details.map((detail) => (66 <li key={detail} className="rounded-md bg-muted px-3 py-2">67 {detail}68 </li>69 ))}70 </ul>71 ) : null}72 </CardContent>73 <CardFooter className="justify-end gap-2">74// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from fable-ui
All 10 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| FormCardform-card | fable-ui | Components | Free | 2 deps · 4 files | |
| MetricCardmetric-card | fable-ui | Components | Free | 3 deps · 4 files | |
| SuggestedActionssuggested-actions | fable-ui | Components | Free | 2 deps · 4 files |
