Popover
Contextual information, compact actions and lightweight forms anchored to a trigger.
Purpose
Use Popover for short contextual interactions, supporting information or compact forms anchored to a trigger without leaving the current workflow.
Form popover
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/popoverImport
import { Popover } from "@/components/ui/popover";
import { PopoverClose, PopoverContent, PopoverCreateHandle, PopoverDescription, PopoverPopup, PopoverTitle, PopoverTrigger } from "@/components/ui/popover";
import { Field } from "@/components/ui/field";
import { Form } from "@/components/ui/form";
import { Textarea } from "@/components/ui/textarea";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";Need the machine-readable source metadata? View registry JSON.
Usage
Use Popover for small contextual forms and helpers anchored to a trigger. Use Dialog for larger modal tasks.
import type { FormEvent } from "react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { Field, FieldLabel } from "@/components/ui/field";
import { Form } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import {
Popover,
PopoverClose,
PopoverDescription,
PopoverPopup,
PopoverTitle,
PopoverTrigger,
} from "@/components/ui/popover";
export function Example() {
const [open, setOpen] = useState(false);
function onSubmit(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
setOpen(false);
}
return (
<Popover onOpenChange={setOpen} open={open}>
<PopoverTrigger render={<Button variant="outline" />}>
Invite member
</PopoverTrigger>
<PopoverPopup className="w-72">
<Form className="grid gap-3" onSubmit={onSubmit}>
<div className="grid gap-1">
<PopoverTitle>Invite member</PopoverTitle>
<PopoverDescription>Send a role-limited invitation.</PopoverDescription>
</div>
<Field name="email">
<FieldLabel>Email</FieldLabel>
<Input placeholder="maya@company.com" required type="email" />
</Field>
<div className="flex justify-end gap-2">
<PopoverClose render={<Button type="button" variant="ghost" />}>
Cancel
</PopoverClose>
<Button type="submit">Send</Button>
</div>
</Form>
</PopoverPopup>
</Popover>
);
}Examples
Placement, close buttons, the tooltip style, detached triggers and practical compositions are props and compositions of the same primitive.
Basic
Controlled
Placement
side and align position the popup around the trigger; sideOffset and alignOffset fine-tune the distance.
With close button
Tooltip style
tooltipStyle switches the popup to compact tooltip sizing. Combined with openOnHover it works as a rich hover hint.
Detached triggers
PopoverCreateHandle connects detached triggers to one shared popup that morphs between payloads.
Quick actions
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
- Compose
Popover,PopoverTriggerandPopoverPopup; the popup already owns its portal and positioner. PopoverPopupacceptsside,align,sideOffset,alignOffset,anchor,portalPropsand the popup content props.- Use
PopoverTitle,PopoverDescriptionandPopoverClosefor structured, dismissible content. PopoverCreateHandlesupports detached triggers or externally controlled popup access when the normal trigger relationship is not sufficient.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
PopoverPopupuses the shared floating-panel fade, scale and directional offset tokens.- Collision handling, transform origin and reduced-motion behavior remain part of the native Siteplane floating-panel contract.
Accessibility
- Escape, outside click and focus management are provided by Base UI and must remain intact.
- Give icon-only triggers an accessible name and use
PopoverTitleandPopoverDescriptionfor structured content. - Use Tooltip for a non-interactive hint and Dialog or Alert Dialog for long or critical tasks.
Implementation Guidance
- Keep portal, positioning, focus and dismissal logic inside the primitive.
- Prefer the regular trigger relationship; use
anchororPopoverCreateHandleonly for a genuine detached-anchor requirement. - Do not use Popover for irreversible decisions or long forms.