Installation
npx logic2b@next add popoverUsage
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-expandedandaria-controlsfor 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
PopoverAnchorto 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.
Popover
ComponentProps: React.ComponentProps<typeof PopoverPrimitive.Root>PopoverTrigger
ComponentProps: React.ComponentProps<typeof PopoverPrimitive.Trigger>PopoverContent
ComponentProps: React.ComponentProps<typeof PopoverPrimitive.Content>| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
align | "center" | "end" | "start" | No | "center" | — |
sideOffset | number | No | 4 | — |
PopoverAnchor
ComponentProps: React.ComponentProps<typeof PopoverPrimitive.Anchor>Accessibility contract
Machine-readable behavior and consumer responsibilities for popover.
- Support
- Primitive-managed
- Pattern
- non-modal dialog
- Radix Popover
| Keys | Behavior |
|---|---|
| Enter Space | Activate the focused control. |
| Escape | Close 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.