Skip to content

Popover

An accessible popup anchored to a button.

API Reference

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.

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.