Comparison between Astro (Saastro) and React (shadcn/ui) versions
🚀 saastro/ui (Astro)
⚛️ shadcn/ui (React)
Installation
Usage
---
import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui-saastro/popover";
import { Button } from "@/components/ui-saastro/button";
---
<Popover>
<PopoverTrigger>
<Button variant="outline">Open popover</Button>
</PopoverTrigger>
<PopoverContent>
<p>Content goes here</p>
</PopoverContent>
</Popover>
Examples
Basic
<Popover>
<PopoverTrigger>
<Button>Click me</Button>
</PopoverTrigger>
<PopoverContent>
<p>Simple popover content</p>
</PopoverContent>
</Popover>
With Form
<Popover>
<PopoverTrigger>
<Button variant="outline">Open settings</Button>
</PopoverTrigger>
<PopoverContent class="w-80">
<div class="grid gap-4">
<div class="space-y-2">
<h4 class="font-medium leading-none">Dimensions</h4>
<p class="text-muted-foreground text-sm">
Set the dimensions for the layer.
</p>
</div>
<div class="grid gap-2">
<div class="grid grid-cols-3 items-center gap-4">
<Label for="width">Width</Label>
<Input id="width" value="100%" class="col-span-2 h-8" />
</div>
<div class="grid grid-cols-3 items-center gap-4">
<Label for="height">Height</Label>
<Input id="height" value="25px" class="col-span-2 h-8" />
</div>
</div>
</div>
</PopoverContent>
</Popover>
Components
Popover
The root container that manages the popover state.
PopoverTrigger
The element that triggers the popover when clicked.
PopoverContent
The content displayed inside the popover.
PopoverAnchor
An optional anchor element for positioning (advanced use cases).
Props
Popover
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean | false | Whether the popover is open by default |
class | string | - | Additional CSS classes |
PopoverTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
class | string | - | Additional CSS classes |
PopoverContent
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "bottom" | "left" | "right" | "bottom" | Preferred side for positioning |
align | "start" | "center" | "end" | "center" | Alignment along the side |
sideOffset | number | 4 | Distance from the trigger |
class | string | - | Additional CSS classes |
Data Attributes
Popover
| Attribute | Values | Description |
|---|---|---|
data-state | "open" | "closed" | The current state of the popover |
PopoverContent
| Attribute | Values | Description |
|---|---|---|
data-state | "open" | "closed" | The current state of the content |
data-side | "top" | "bottom" | "left" | "right" | The current side |
data-align | "start" | "center" | "end" | The current alignment |
Accessibility
- Trigger uses
aria-expandedto indicate state - Trigger uses
aria-haspopup="dialog"to indicate popover behavior - Content uses
role="dialog"for screen readers - Focus is trapped inside popover when open
- Pressing Escape closes the popover
- Clicking outside closes the popover
Performance
Performance Benchmark
Bundle Size
~2KB vs ~185KB
99% menos
Hydration
0ms vs --
Sin hydration
Open Response
-- vs --
Interactúa para medir
Saastro (Vanilla JS)
shadcn (React)
Haz click en "Ejecutar Test" o interactúa con los componentes (click) para medir el rendimiento.