Skip to documentation

Design system / Molecules

Molecule / Disclosure

Popover

Popover displays portaled content relative to a trigger or separate anchor. Radix owns positioning and disclosure. The caller owns content, drafts and commands, including any controlled close action.

Live example

Live preview

Current component with fictional data. Example changes are not persisted.

Responsibility

The trigger, optional anchor and portaled content form one contextual-disclosure contract. A form inside the popover retains its own draft and save lifecycle. The container does not supply those behaviors.

Public contract

The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
open / defaultOpen / onOpenChange / modalRadix Root propsOptionalOpen-state and modality contracts are delegated to Radix.
align / sideOffsetContent propsDefaults center / 4Portaled positioning.
containerHTMLElement | nullContent · optionalPortal owner for theme inheritance or nested modality; omitted keeps the body portal. Positioning, dismissal and focus remain Radix-owned.
className / childrenPart propsConsumer assemblyContent defaults to w-72; override deliberately for context.

API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.

State and behavior

Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.

No fetching or save logic. Radix handles positioning/disclosure; the consumer owns any draft and operation inside the content.

Dependencies

  • Radix Popover Root, Trigger, Anchor, Portal and Content
  • Local Header, Title and Description
  • cn()

Token and styling contract

These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.

bg-popover / text-popover-foreground
Contextual surface roles.
border / shadow-md / rounded-md / p-4
Shared geometry.
text-muted-foreground
Description role.

Boundaries and limitations

  • PopoverTitle is typed with h2 props but actually renders a div; do not infer heading semantics.
  • There is no exported local PopoverClose; explicit consumer close can bind controlled state.

Where to make a change

Change common anchored content in popover.tsx. Keep contextual draft/save policy outside the container. Preserve accessible naming and explicit exits.

Selected real uses

EditionSelections

The internal single-tag editor supplies its nearest tenant-theme container, accessible name and explicit Close command. The feature hook owns disclosure and saves; Radix owns focus restoration, keyboard dismissal and collision-aware positioning. The public organism is disabled and never issues tenant writes.

Repository path: src/components/selections/editionSelections.tsx

These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.

Usage contract

import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";

<Popover open={open} onOpenChange={setOpen}>
  <PopoverTrigger>Read context</PopoverTrigger>
  <PopoverContent><h2>Context</h2>{content}
    <button onClick={() => setOpen(false)}>Close</button>
  </PopoverContent>
</Popover>

Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.