Popover
A floating panel for settings and details tied to a button.
import { Button, Popover } from "@openperf/deft";
import { Preview } from "../../src/Preview";
export default function PopoverBasic() {
return (
<Preview overlay={true}>
<Popover.Root>
<Popover.Trigger render={<Button.Root />}>Open popover</Popover.Trigger>
<Popover.Content>
<Popover.Title>Title</Popover.Title>
<Popover.Description>Description</Popover.Description>
</Popover.Content>
</Popover.Root>
</Preview>
);
}
- Use a popover for a few controls that change the view, or details about the item on the trigger. Use a Dialog for a task with a submit action, and a Menu for a list of actions.
Popover.Titlelabels the popup for screen readers;Popover.Descriptionadds a line of context under it.- Set the width on
Popover.Content. Popover.Contentaligns to the start of the trigger and opens below it; passalignandsideto move it.
API
PropType
align?"start" | "center" | "end"
On Content.
Type
"start" | "center" | "end"Default
"start"side?"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"
On Content.
Type
"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"Default
"bottom"Parts: Root, Content, Description, Title, plus the other Base UI Popover parts, such as Trigger and Close. Content wraps Portal, Positioner and Popup. Built on Base UI Popover.