Popover
Popover opens a small panel beside the control that opened it, while the rest of the page stays usable.
<Popover> <PopoverTrigger render={<Button>Rename</Button>} /> <PopoverContent> <PopoverTitle>Rename project</PopoverTitle> <PopoverDescription> This changes the name everywhere. </PopoverDescription> <PopoverClose render={<Button emphasis="loud">Save</Button>} /> </PopoverContent></Popover>Use a Popover to show a small panel next to a control without blocking the page behind it. It can hold whatever you put in it, such as a short form, a filter panel or a summary of a person.
Each floating component has its own job. A Menu lists actions, and a Select chooses one value. A Dialog holds a task that the person must finish before they continue, and an AlertDialog asks one question. A Tooltip shows a short label for a control.
Pass your own Button to PopoverTrigger through render, and the panel opens beside it. Set side and align on PopoverContent to choose where the panel prefers to open. When that side has no room, the panel moves to the opposite side, and it always stays on screen.
size on Popover sets the panel's padding and corner, together with the text size of PopoverTitle and PopoverDescription. Content that you add keeps the sizes you give it. The panel uses the material that your Theme sets, so it is glass when the theme's material is glass and solid otherwise.
Give every panel a PopoverTitle, because screen readers announce the panel by its title and read PopoverDescription with it. Escape or a press outside the panel closes it and returns focus to the trigger. For a close or save action inside the panel, wrap your own Button in PopoverClose. To open and close the panel from your own code, use open and onOpenChange.
Topics
Every symbol this component exports, grouped by the job it does. Each one carries the props it declares; each one has an anchor of its own.
Opening the panel
Popover
Popover opens a small panel beside the control that opened it, while the rest of the page stays usable.
| Prop | Type | What it does |
|---|---|---|
children? | React.ReactNode | The PopoverTrigger and the PopoverContent, in that order. |
defaultOpen? | boolean | Uncontrolled starting state. |
onOpenChange? | (open: boolean, details: PopoverOpenChangeDetails) => void | Called when the panel opens or closes. |
open? | boolean | Controlled open state. |
size? | "1" | "2" | "3" | "4" | Sets the size step of the panel's padding and corner. |
Placing the panel
PopoverContent
The panel itself. It holds your content and accepts the side and align that you prefer
| Prop | Type | What it does |
|---|---|---|
align? | "start" | "center" | "end" | How it lines up along that side. |
children? | React.ReactNode | The panel's content, and it belongs to you. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
side? | "top" | "right" | "bottom" | "left" | Which side of the trigger to prefer. |
sideOffset? | number | The gap from the trigger, in pixels. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
It also takes every prop of a <div>.
Naming the panel
| Prop | Type | What it does |
|---|---|---|
children? | React.ReactNode | The panel's name. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
It also takes every prop of a <h2>.
PopoverDescription
A supporting line that a screen reader reads after the title, so avoid repeating the title's words in it
| Prop | Type | What it does |
|---|---|---|
children? | React.ReactNode | The supporting text under the title. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
It also takes every prop of a <p>.
- A modal mode — A Popover always leaves the page usable. When the page must wait for an answer, use a Dialog, or an AlertDialog for a single question.
- An arrow — The panel has its own border and opens right beside its trigger, so it is already clear which control it belongs to.
- Free positioning — You choose a preferred side and alignment, and the panel moves itself when that side has no room. Arbitrary coordinates would break that guarantee on small windows.
- A width that matches the trigger — A popover holds a form or a summary, so its width comes from its content rather than from the button that opened it. A Menu or a Select matches its trigger's width instead.
- A built-in close button — Escape and a press outside the panel already close it. If you want a visible button as well, wrap your own Button in
PopoverCloseand place it where your layout needs it.