Popover
Anchored panel that scales from its trigger. Closes on outside click and Escape, and returns focus.
- Category: Overlays
- Licence: Free, MIT
- Built with: React 19, Tailwind CSS 4, Motion
- Dependencies: motion, clsx, tailwind-merge
Examples
Popover
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
trigger | ReactElement | — | |
open / onOpenChange | boolean / (open: boolean) => void | — | |
align | "start" | "center" | "end" | "center" | |
children | ReactNode | ((close: () => void) => ReactNode) | — |
About Popover
Popover is an anchored panel that scales from its trigger, closes on outside click or Escape and returns focus. It holds small forms, filters and rich content without a full dialog.
Popover is an overlay component for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.
When to use Popover
- Filter and sort panels.
- Quick edit forms.
- Share and invite panels.
- Date and colour pickers.
How it works
Its transform origin is set from the trigger side, so it grows out of the button. Focus moves into the panel on open and back to the trigger on close.
It traps and returns focus correctly, closes on Escape, and is announced to screen readers with the right dialog or menu role. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.
Customizing Popover
Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.
The Customize panel next to the preview lets you change align, label live, and the Code tab updates to match, so the snippet you copy already carries your values.
- trigger (ReactElement).
- open / onOpenChange.
- align ("start" | "center" | "end", default "center").
Goes well with Popover
These overlays pieces share its tokens and motion language, so they sit together on one page without clashing.
- Tooltip: An animated React tooltip that springs from its trigger, with instant neighbours
- Dialog: An animated React dialog on the native dialog element, with blur and scale transitions
- Drawer: A React bottom sheet drawer you can fling closed, with rubber-banding at the top
- Toast: Animated React toasts that stack, fan out on hover and swipe away
- Sheet: An animated React side sheet on the native dialog element that you can fling closed
Install Popover
npx shadcn@latest add https://charcoalui.com/r/popover.jsonPopover is free and MIT licensed. The command copies popover.tsx into components/ui and installs clsx, tailwind-merge; you can also copy the source from the Code tab by hand.
It pairs well with Morph Menu, a Pro piece: A button that stretches into its own menu surface, then shrinks back. Arrow keys and Escape work.
Frequently asked questions
- How do I install Popover?
- Run npx shadcn@latest add https://charcoalui.com/r/popover.json. The shadcn CLI copies popover.tsx into components/ui and installs motion, clsx, tailwind-merge. You can also copy the source from this page by hand.
- Is Popover free for commercial use?
- Yes. Popover is MIT licensed: use it in any personal or commercial project and change it however you like.
- Does Popover work with Next.js?
- Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
- Can an AI coding agent install Popover?
- Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns Popover's props and source and get_install_command returns the exact command.