Skip to content
Browse docs and components

Popover

popover

A small surface anchored to a trigger, with a title and a description that Base UI wires into the accessibility tree so the popover is announced with a name. Collision-aware placement, portalled so it escapes overflow, and a Close part for the explicit way out.

Responsive

Install

$npxshadcnadd@forme/popover

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import {
  Popover, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger,
} from "@/components/forme/popover/popover";

<Popover>
  <PopoverTrigger asChild>
    <Button variant="secondary">Share</Button>
  </PopoverTrigger>
  <PopoverContent>
    <PopoverTitle>Share this view</PopoverTitle>
    <PopoverDescription>Anyone with the link can see it.</PopoverDescription>
  </PopoverContent>
</Popover>

When to use

Reach for it

  • Small interactive panels anchored to a control: a share box, a quick filter, a colour picker.

Use something else

  • Content that blocks the page until it is handled — that is a Dialog.
  • Plain text hints on hover; use a Tooltip.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

PopoverTrigger

PropTypeDefaultDescription
asChildboolean—Render as the single child element instead of a <button>, keeping the trigger behaviour.

Also takes every prop of Base UI Popover.Trigger.

The other parts

  • PopoverTakes Base UI Popover.Root
  • PopoverContentTakes Base UI Popover.Popup and Pick<ComponentProps<typeof PopoverPrimitive.Positioner>, "side" | "sideOffset" | "align">
  • PopoverTitleTakes Base UI Popover.Title
  • PopoverDescriptionTakes Base UI Popover.Description
  • PopoverCloseTakes Base UI Popover.Close

Accessibility

  • PopoverTitle and PopoverDescription make it announced as a dialog with a name and a description.
  • Base UI moves focus in, closes on Esc and returns focus to the trigger.

Motion

  • It grows from its trigger with a slight scale and blur, and exits faster than it enters.