Make your AI a shadcn expert

Shadcn Popover

React popover for settings panels, filters, and inline forms. Built with TypeScript and Tailwind CSS for Next.js using Base UI — click to open, no focus trap.

The shadcn popover is a panel that opens from a click and stays until you click outside or press Escape. Use it for a short form, a filter, or extra controls next to a button. A phrase is a Tooltip. Blocking the page is a Dialog.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same popover, thicker borders. The NeoBrutalism popover is the kit if you want that look.

Usage

import { Button } from "@/components/ui/button"
import {
  Popover,
  PopoverContent,
  PopoverDescription,
  PopoverHeader,
  PopoverTitle,
  PopoverTrigger,
} from "@/components/ui/popover"
<Popover>
  <PopoverTrigger render={<Button variant="outline" />}>
    Open Popover
  </PopoverTrigger>
  <PopoverContent>
    <PopoverHeader>
      <PopoverTitle>Title</PopoverTitle>
      <PopoverDescription>Description text here.</PopoverDescription>
    </PopoverHeader>
  </PopoverContent>
</Popover>

render={<Button />} keeps the Button as the trigger. align defaults to center. sideOffset is 4.

Composition

PopoverTrigger
PopoverTitle
PopoverDescription

PopoverAnchor is optional — position against something other than the trigger.

Basic

Header, title, description. align="start" pins the panel to the leading edge.

Scroll to load preview...

Align

align on PopoverContent is start, center, or end.

Scroll to load preview...

With Form

Fields stay next to the trigger. The rest of the page is still live.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Physical side values stay left and right.

Scroll to load preview...

API

Prop

Type

PopoverContent

Prop

Type

PopoverTrigger and PopoverAnchor take render. PopoverHeader, PopoverTitle, and PopoverDescription take className.

Keyboard

KeyAction
Space / EnterOpen or close from the trigger
Tab / Shift + TabNext / previous focusable control
EscapeClose and return focus to the trigger

Focus is not trapped. Tab can leave the panel.

Notes

A portaled child can close it

A Select or Calendar inside the panel is portaled, so the click looks outside. Call event.preventDefault() on onInteractOutside, or set modal.

Keep the panel short. A long workflow is a Dialog.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.