Popover
FeedbackFloating content panel triggered by a button click. Used for filters and mini-forms.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import {
Popover,
PopoverTrigger,
PopoverContent,
} from "@dashboardpack/core/components/ui/popover";
import { Button } from "@dashboardpack/core/components/ui/button";
import { Label } from "@dashboardpack/core/components/ui/label";
import { Input } from "@dashboardpack/core/components/ui/input";
export default function PopoverExample() {
return (
<Popover>
<PopoverTrigger asChild>
<Button variant="outline">Set dimensions</Button>
</PopoverTrigger>
<PopoverContent align="center" className="w-72">
<div className="space-y-4">
<div>
<h3 className="font-medium">Dimensions</h3>
<p className="text-xs text-muted-foreground">
Set a width for your panel.
</p>
</div>
<div className="space-y-2">
<Label htmlFor="popover-width">Width</Label>
<Input id="popover-width" defaultValue="320px" />
</div>
</div>
</PopoverContent>
</Popover>
);
}Usage
Use for compact contextual controls. Compose PopoverTrigger and PopoverContent; keep larger forms in a Dialog or Sheet. Position with side and align.
import {
Popover,
PopoverTrigger,
PopoverContent,
} from "@dashboardpack/core/components/ui/popover";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| open / defaultOpen | booleanDefault: false | Controlled or initial visibility. |
| onOpenChange | (open: boolean) => voidDefault: — | Handle visibility changes. |
| align (PopoverContent) | start | center | endDefault: center | Alignment relative to the trigger. |
| side (PopoverContent) | top | right | bottom | leftDefault: bottom | Preferred placement. |
| sideOffset (PopoverContent) | numberDefault: 0 | Gap from the trigger. |