- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Menubar
- Message
- Meter
- Number Field
- OTP Field
- Pagination
- Popover
- Preview Card
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Toolbar
- Tooltip
- Artifact
- Audio Player
- Canvas
- Chain of Thought
- Checkpoint
- Code Block
- Commit
- Connection
- Context
- Controls
- Edge
- Environment Variables
- Mic Selector
- Model Selector
- Node
- Node Toolbar
- Open in Chat
- Panel
- Plan
- Prompt Input
- Queue
- Reasoning
- Sandbox
- Schema Display
- Shimmer
- Snippet
- Sources
- Speech Input
- Stack Trace
- Suggestion
- Tool
- Transcription
- Web Preview
Popover
An accessible popup anchored to a button.
"use client";
import { Button } from "@/components/ui/button";
import { Field } from "@/components/ui/field";
import {
Popover,
PopoverContent,
PopoverDescription,
PopoverTitle,
PopoverTrigger,
} from "@/components/ui/popover";
import { Textarea } from "@/components/ui/textarea";
export default function Particle() {
return (
<Popover>
<PopoverTrigger nativeButton render={<Button variant="outline" />}>
Open Popover
</PopoverTrigger>
<PopoverContent className="w-80">
<div className="mb-4">
<PopoverTitle className="text-base">Send us feedback</PopoverTitle>
<PopoverDescription>Let us know how we can improve.</PopoverDescription>
</div>
<form className="flex w-full flex-col gap-4">
<Field>
<Textarea aria-label="Send feedback" id="feedback" placeholder="How can we improve?" />
</Field>
<Button type="submit">Send feedback</Button>
</form>
</PopoverContent>
</Popover>
);
}
Installation
pnpm dlx shadcn@latest add @frontal-labs/popover
Usage
import {
Popover,
PopoverContent,
PopoverDescription,
PopoverHeader,
PopoverTitle,
PopoverTrigger,
} from "@/components/ui/popover";<Popover>
<PopoverTrigger>Open Popover</PopoverTrigger>
<PopoverContent>
<PopoverHeader>
<PopoverTitle>Popover Title</PopoverTitle>
<PopoverDescription>Popover Description</PopoverDescription>
</PopoverHeader>
</PopoverContent>
</Popover>API Reference
Popover
Root component. Alias for Popover.Root from Base UI.
PopoverTrigger
Trigger button that opens the popover. Alias for Popover.Trigger from Base UI.
PopoverContent
Popup container that displays the popover content. The surface is elevated with shadow-menu and surface-ring.
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "bottom" | "left" | "right" | "bottom" | Side of the trigger to position the popup |
align | "start" | "center" | "end" | "center" | Alignment relative to the trigger |
sideOffset | number | 4 | Distance from the trigger in pixels |
alignOffset | number | 0 | Offset along the alignment axis |
dark | boolean | true | Renders the surface with the dark palette |
About dark: the popover renders with the dark palette by default. Pass dark={false} when it should follow the ambient theme instead — next-themes sets dark on <html> and the portal lands in document.body, inside it, so the popover can pick up the ambient theme once dark is turned off. For a popover opened from a .dark region scoped mid-page, which a portal does escape, rendering into the scoped node is usually the better tool. dark applies .dark to the positioner inside the portal, so the tokens inherit down to the popup and everything within it.
PopoverHeader
Header section of the popover, typically wrapping PopoverTitle and PopoverDescription.
PopoverTitle
Title text for the popover. Styled wrapper for Popover.Title from Base UI.
PopoverDescription
Description text for the popover. Styled wrapper for Popover.Description from Base UI.
Examples
Info Popover
A popover is a good fit for an info icon button whose only purpose is to show additional information. See the tooltip accessibility guidelines for best practices.
"use client";
import { InfoIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
export default function Particle() {
return (
<InputGroup>
<InputGroupInput aria-label="Password" placeholder="Password" type="password" />
<InputGroupAddon align="inline-end">
<Popover>
<PopoverTrigger
nativeButton
openOnHover
render={<Button aria-label="Password requirements" size="icon-xs" variant="ghost" />}
>
<InfoIcon />
</PopoverTrigger>
<PopoverContent side="top">
<p>Min. 8 characters</p>
</PopoverContent>
</Popover>
</InputGroupAddon>
</InputGroup>
);
}