Comparación entre la versión Astro (Saastro) y React (shadcn/ui)
🚀 saastro/ui (Astro)
Are you absolutely sure?
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
⚛️ shadcn/ui (React)
Installation
Usage
---
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
} from "@/components/ui-saastro/alert-dialog"
import { Button } from "@/components/ui-saastro/button"
---
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Open Dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
Examples
Basic
<AlertDialog>
<AlertDialogTrigger>Open</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Confirm action</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to proceed?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>No</AlertDialogCancel>
<AlertDialogAction>Yes</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
With Custom Trigger
Use asChild to use your own button component as trigger.
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="destructive">Delete Account</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Account</AlertDialogTitle>
<AlertDialogDescription>
This will permanently delete your account. This action cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Keep Account</AlertDialogCancel>
<AlertDialogAction>Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
Props
AlertDialog
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | auto | Unique identifier for the dialog |
class | string | - | Additional CSS classes |
AlertDialogTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Render child element instead of button |
for | string | - | ID of dialog to trigger (for external triggers) |
class | string | - | Additional CSS classes |
AlertDialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
animationDuration | number | 200 | Animation duration in milliseconds |
class | string | - | Additional CSS classes |
AlertDialogHeader / AlertDialogFooter
| Prop | Type | Default | Description |
|---|---|---|---|
class | string | - | Additional CSS classes |
AlertDialogTitle / AlertDialogDescription
| Prop | Type | Default | Description |
|---|---|---|---|
class | string | - | Additional CSS classes |
AlertDialogAction / AlertDialogCancel
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Render child element instead of button |
class | string | - | Additional CSS classes |
Accessibility
- Uses native
<dialog>element withrole="alertdialog" - Automatic
aria-labelledbyandaria-describedbyattributes - Focus is trapped within the dialog when open
- ESC key closes the dialog
- Cannot be closed by clicking outside (unlike regular Dialog)
- Screen reader announces the dialog title and description
Performance
Performance Benchmark
Bundle Size
~3KB vs ~180KB
98% menos
Hydration
0ms vs --
Sin hydration
Open Response
-- vs --
Interactúa para medir
Saastro (Vanilla JS)
Are you absolutely sure?
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
shadcn (React)
Haz click en "Ejecutar Test" o interactúa con los componentes (click) para medir el rendimiento.