ComponentsOverlays & menus
Popover
Shared primitiveShow a small interactive tool near its trigger.
@/components/ui/popover
Composition preview
Try Popover alongside its related overlays & menus components. These examples keep all actions local.
Usage
import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";
import { Button } from "@/components/ui/button";
<>
{/* Inside a native modal, dialogElement is its mounted element; otherwise omit portalContainer. */}
<Popover>
<PopoverTrigger asChild><Button variant="outline">Options</Button></PopoverTrigger>
<PopoverContent aria-label="Options" portalContainer={dialogElement}>Contextual controls</PopoverContent>
</Popover>
</>Composition recipe. Supply application state, handlers and persistence in the owning product component. Inspect the installed source before extending its API.
API & composition
open/defaultOpen, onOpenChange; PopoverTrigger, PopoverContent (portalContainer), PopoverAnchor
Usage & accessibility
Provide a clear accessible name. Inside a native modal, set portalContainer to that dialog so the tool remains in the top layer. Use Dialog when the task requires a modal workflow.
Implementation contract
src/components/ui/popover.tsx
Use named variants and semantic theme tokens. Preserve existing input values, refs, focus and cancellation behavior. Verify keyboard, narrow layouts and pending/error states when behavior changes.