Component guideEditable source

Popover

A floating surface opened from a nearby trigger.

Original component docs
On this page4 sectionsBack to top

Use Popover for contextual controls that do not need a full-screen interruption. PopoverContent includes positioning and a portal. Use Dialog for a longer focused task.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/popover.json

The trigger example additionally uses Button.

#Usage

import { Button } from "@/components/ui/button";
import {
  Popover,
  PopoverTrigger,
  PopoverContent,
  PopoverTitle,
  PopoverDescription,
} from "@/components/ui/popover";

export default function HelpPopover() {
  return (
    <Popover>
      <PopoverTrigger render={<Button variant="outline" />}>Sharing help</PopoverTrigger>
      <PopoverContent>
        <PopoverTitle>Workspace sharing</PopoverTitle>
        <PopoverDescription>Only invited members can open this workspace.</PopoverDescription>
        <a href="/docs" className="underline">
          Read the guide
        </a>
      </PopoverContent>
    </Popover>
  );
}

#API reference

Prop / partPurposeDefault
Popover.open / onOpenChangeControlled visibilityUncontrolled
Popover.defaultOpenInitial visibilityfalse
PopoverTrigger.renderTrigger button compositionPrimitive button
PopoverContent.side / alignPreferred placementbottom / center
PopoverContent.sideOffsetTrigger-to-popup gap4
PopoverContent.initialFocus / finalFocusFocus destinationsBase UI behavior
PopoverContent.alignOffset / arrowPadding / collisionPaddingAlignment, arrow, and collision-boundary spacing, in pixels0

#Accessibility

Name the popup with PopoverTitle and explain its purpose when needed. Keep controls reachable and verify Escape dismissal and focus return. Do not move essential instructions into a popup users must discover before they can complete a form.