Skip to content
Logic2BUI

Search docs

Search components and documentation

New
Menu

Popover

Displays rich content in a portal, triggered by a button.

Installation

npx logic2b@next add popover

Usage

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

<Popover>
  <PopoverTrigger>Open</PopoverTrigger>
  <PopoverContent>Place content for the popover here.</PopoverContent>
</Popover>

Examples

Form content

Side and alignment

Accessibility

Built on Radix Popover.

  • The trigger toggles the popover on click and manages aria-expanded and aria-controls for you.
  • Focus moves into the popover when it opens and returns to the trigger on close.
  • Esc or an outside click dismisses the popover.
  • Use PopoverAnchor to position the content relative to a different element than the trigger.

Live playground

Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.

Generated JSX
<Popover>
  <PopoverTrigger
    className="rounded-md border px-4 py-2 text-sm font-medium"
  >Release details</PopoverTrigger>
  <PopoverContent>Version 1.2 is ready after all quality gates pass.</PopoverContent>
</Popover>

API reference

Generated from the public TypeScript exports in src/ui/popover.tsx.

View JSON

Popover

Component
Props: React.ComponentProps<typeof PopoverPrimitive.Root>

PopoverTrigger

Component
Props: React.ComponentProps<typeof PopoverPrimitive.Trigger>

PopoverContent

Component
Props: React.ComponentProps<typeof PopoverPrimitive.Content>
PropTypeRequiredDefaultDescription
align"center" | "end" | "start"No"center"—
sideOffsetnumberNo4—

PopoverAnchor

Component
Props: React.ComponentProps<typeof PopoverPrimitive.Anchor>

Accessibility contract

Machine-readable behavior and consumer responsibilities for popover.

View JSON
Support
Primitive-managed
Pattern
non-modal dialog
Radix Popover
Keyboard interactions for popover
KeysBehavior
Enter SpaceActivate the focused control.
EscapeClose the open surface and restore focus.

Built-in semantics

  • The trigger manages aria-expanded and aria-controls; focus can move into the portal content.

Consumer responsibilities

  • Label the trigger and provide an explicit close path for complex content.