Popover

Headless popover primitives anchored to trigger or anchor elements.

Stable direction
@lattice-ui/popover

Part of the stable direction toward v1.0.

What It Is For

Use Popover for anchored surfaces that should stay connected to a trigger or anchor without taking over the full interaction mode like a dialog.

It is the right fit for inline help, quick settings, or compact secondary editors.

Preview size

Live demo is experimental and may contain bugs.

Install

Global CLI command: lattice add popover

Monorepo local script

Use your package manager wrapper when running the local lattice command.

pnpm lattice add popover

npm package: @lattice-ui/popover

Peer dependencies

  • @rbxts/react
  • @rbxts/react-roblox

Providers

  • @lattice-ui/layer:PortalProvider? (optional)

Registry notes

  • Popover.Content can safely manage displayOrder with PortalProvider.

Public Exports

  • Popover
  • Popover.Root
  • Popover.Trigger
  • Popover.Portal
  • Popover.Content
  • Popover.Anchor
  • Popover.Close
  • PopoverAnchor
  • PopoverClose
  • PopoverContent
  • PopoverPortal
  • PopoverRoot
  • PopoverTrigger

State Model

  • Popover.Root manages controlled or uncontrolled open state and optional modal behavior.
  • Trigger, anchor, and content refs are part of the shared context so positioning stays synchronized.
  • Content uses popper placement data plus layer dismissal semantics rather than in-place layout flow.

Key API

Popover.Root

Use open, defaultOpen, onOpenChange, and modal to define how heavy the overlay interaction model should be.

Popover.Anchor

Use an explicit anchor when the positioned content should attach to something other than the trigger itself.

Popover.Content

Use placement, offset, padding, and outside-interaction hooks to control geometry and dismissal.

Popover.Close

Attach dismiss behavior to any host element inside the content without introducing extra state plumbing.

Composition Patterns

Quick settings panel

Use a trigger for entry, then place short form controls inside Popover.Content when the edit surface should remain lightweight.

Detached anchor workflows

Use Popover.Anchor when the UI affordance that opens the surface is not the same visual target the surface should align to.

Cautions / Limits

  • Because popovers are anchored overlays, they still benefit from a shared PortalProvider near the app root.
  • Use Dialog instead when the content should trap attention or own a stronger modal interaction contract.
  • Let Popper own placement and motion own the animated wrapper so anchor geometry and transition state do not fight.

Decision Guides