Documentation / Feedback & overlays
Popover
An interactive panel anchored to its trigger: a small form beside a button, filters, details the reader acts on. Unlike Tooltip, its content takes the focus; unlike Modal, the page behind stays live.
Four pieces: Popover (the state, controlled or not), PopoverTrigger (the trigger, or its child with asChild), PopoverContent (the panel) and PopoverClose. The panel is rendered under the <body> of its trigger’s document: no parent in overflow: hidden cuts it, it goes to the other side when that has more room and stays inside the window.
On opening, the focus goes to the first field or button of the panel. Escape and PopoverClose give it back to the trigger; Tab past the last element closes the panel and moves on to what follows the trigger. In a Modal, the panel stays live and its Escape leaves the modal open. "use client" component.
Examples
Basic usage
PopoverTrigger draws a button; the panel opens below it, centred, and carries the name of its trigger.
import { Popover, PopoverContent, PopoverTrigger } from "@synertech/ui";
export function Basic() {
return (
<Popover>
<PopoverTrigger>Échéance</PopoverTrigger>
<PopoverContent className="w-64">
<p className="font-medium">Facture F-2026-118</p>
<p className="mt-1 text-gray-600 dark:text-gray-300">
À régler avant le 15 décembre 2026. Une relance part trois jours avant.
</p>
</PopoverContent>
</Popover>
);
}Filters
A Button of the kit becomes the trigger with asChild. The panel holds a small form; "Apply" is a PopoverClose, which closes and gives the focus back to the button.
import { useState } from "react";
import { Button, Checkbox, Input, Popover, PopoverClose, PopoverContent, PopoverTrigger } from "@synertech/ui";
const STATUSES = ["Payée", "En retard", "Brouillon"] as const;
export function Filters() {
const [statuses, setStatuses] = useState<string[]>(["En retard"]);
const [minimum, setMinimum] = useState("500");
const [applied, setApplied] = useState("En retard, 500 $ et plus");
const toggle = (status: string, checked: boolean) =>
setStatuses((current) =>
checked ? [...current, status] : current.filter((value) => value !== status)
);
return (
<div className="flex flex-col items-start gap-3">
<Popover>
<PopoverTrigger asChild>
<Button label="Filtres" />
</PopoverTrigger>
<PopoverContent align="start" className="w-72">
<fieldset className="flex flex-col gap-2">
<legend className="mb-1 font-medium">Statut</legend>
{STATUSES.map((status) => (
<Checkbox
key={status}
label={status}
checked={statuses.includes(status)}
onChange={(checked) => toggle(status, checked)}
/>
))}
</fieldset>
<div className="mt-4">
<Input
label="Montant minimum ($)"
type="number"
value={minimum}
onChange={(event) => setMinimum(event.target.value)}
/>
</div>
<div className="mt-4 flex justify-end gap-2">
<button
type="button"
className="rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700"
onClick={() => {
setStatuses([]);
setMinimum("");
}}
>
Réinitialiser
</button>
<PopoverClose asChild>
<Button
label="Appliquer"
onClick={() =>
setApplied(
[statuses.join(", ") || "Tous les statuts", minimum && `${minimum} $ et plus`]
.filter(Boolean)
.join(", ")
)
}
/>
</PopoverClose>
</div>
</PopoverContent>
</Popover>
<p className="text-sm text-gray-600 dark:text-gray-300">Filtres appliqués : {applied}</p>
</div>
);
}Sides and alignment
side picks the side of the trigger, align the alignment along it. Near an edge, the panel goes to the other side when that has more room.
import { Popover, PopoverContent, PopoverTrigger } from "@synertech/ui";
export function Sides() {
return (
<div className="flex flex-wrap items-center justify-center gap-4 p-16">
{(["top", "right", "bottom", "left"] as const).map((side) => (
<Popover key={side}>
<PopoverTrigger>{side}</PopoverTrigger>
<PopoverContent side={side} className="w-48">
Ouvert côté <code>{side}</code>.
</PopoverContent>
</Popover>
))}
</div>
);
}Controlled state
With open and onOpenChange, the application holds the state: here, the panel closes once the link is copied. A PopoverClose without text draws a cross named by the popoverClose label.
import { useState } from "react";
import { Button, Input, Popover, PopoverClose, PopoverContent, PopoverTrigger } from "@synertech/ui";
export function Controlled() {
const [open, setOpen] = useState(false);
const [copied, setCopied] = useState(false);
const link = "https://app.example.com/f/2026-118";
return (
<div className="flex items-center gap-3">
<Popover
open={open}
onOpenChange={(next) => {
setOpen(next);
if (next) setCopied(false);
}}
>
<PopoverTrigger>Partager</PopoverTrigger>
<PopoverContent align="start" className="w-80" aria-label="Partager la facture">
<div className="mb-2 flex items-center justify-between">
<p className="font-medium">Lien de la facture</p>
<PopoverClose />
</div>
<Input label="Adresse" hideLabel readOnly value={link} />
<div className="mt-3 flex justify-end">
<Button
label="Copier le lien"
onClick={() => {
void navigator.clipboard?.writeText(link).catch(() => undefined);
setCopied(true);
setOpen(false);
}}
/>
</div>
</PopoverContent>
</Popover>
{copied ? (
<span className="text-sm text-green-700 dark:text-green-400">Lien copié</span>
) : null}
</div>
);
}API reference
Components
An interactive panel anchored to a trigger: a small form beside a button, a group of filters, details that the reader acts on. Unlike a Tooltip, its content takes the focus; unlike a Modal, the page behind stays live.
import { Popover } from "@synertech/ui";Props — PopoverProps
| Prop | Type | Default | Description |
|---|---|---|---|
children• |
ReactNode |
— | A |
closeOnClickOutside |
boolean |
true |
A press outside the panel and its trigger closes it. |
closeOnEscape |
boolean |
true |
Escape closes the panel and puts the focus back on the trigger. |
defaultOpen |
boolean |
false |
Whether the panel starts open, when the Popover holds that state itself. |
onOpenChange |
(open: boolean) => void |
— | Called with the new state each time the panel opens or closes: the trigger, Escape, a press outside, Tab out of the panel or a |
open |
boolean |
— | Whether the panel is open, when the application holds that state. |
Closes the panel it sits in, and puts the focus back on the trigger.
import { PopoverClose } from "@synertech/ui";Props — PopoverCloseProps
| Prop | Type | Default | Description |
|---|---|---|---|
asChild |
boolean |
false |
Makes the child the close control — an "Apply" |
children |
ReactNode |
— | The button's text. Without it, a cross is drawn, named by |
+ 286 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).
The panel. It is rendered while open only, under the <body> of its trigger's document — a detached window's included — so that no ancestor in overflow: hidden cuts it. It is a non-modal dialog named by its trigger, unless given an aria-label or an aria-labelledby.
import { PopoverContent } from "@synertech/ui";Props — PopoverContentProps
| Prop | Type | Default | Description |
|---|---|---|---|
children• |
ReactNode |
— | What the panel holds: text, a form, actions, a |
align |
Align |
— | How the panel lines up with its trigger along that side. |
alignOffset |
number |
— | Shift along the side, in pixels. |
avoidCollisions |
boolean |
— | Keeps the panel inside the viewport: to the other side, then along both axes. |
collisionPadding |
number |
— | The margin kept from the edges of the viewport, in pixels. |
initialFocus |
(panel: HTMLElement) => HTMLElement | null | undefined |
— | The element the focus goes to when the panel opens, found in the panel: the selected day of a calendar rather than its "previous month" button. The first field or button of the panel when it returns nothing. |
side |
Side |
— | The side of the trigger the panel opens on. It goes to the other one only when that has more room. |
sideOffset |
number |
— | Distance between the trigger and the panel, in pixels. |
+ 276 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).
The element that opens and closes the panel, and that the panel is placed against.
import { PopoverTrigger } from "@synertech/ui";Props — PopoverTriggerProps
| Prop | Type | Default | Description |
|---|---|---|---|
children• |
ReactNode |
— | |
asChild |
boolean |
false |
Makes the child the trigger, instead of rendering a button around it — a |
+ 286 inherited native attributes from HTMLAttributes, AriaAttributes, DOMAttributes (className, id, aria-*, event handlers…).