Popover content
In code: PopoverContent
A part of Popover: use it inside one.
The panel of a Popover, placed next to its trigger
Preview
Use
The code of the preview above
import {
Button,
Popover,
PopoverClose,
PopoverContent,
PopoverDescription,
PopoverTitle,
PopoverTrigger,
Switch,
} from '@/components/ui';
import { Filter } from 'lucide-react';
<Popover>
<PopoverTrigger render={<Button />}><Filter />Filter</PopoverTrigger>
<PopoverContent>
<PopoverTitle>Which bookings</PopoverTitle>
<PopoverDescription>The list follows at once</PopoverDescription>
<Switch defaultChecked>Only unpaid</Switch>
<Switch>Include cancelled</Switch>
<PopoverClose render={<Button size="sm" />}>Done</PopoverClose>
</PopoverContent>
</Popover>Options
| Option | Type | What it does |
|---|---|---|
align | "center" | "end" | "start" · default 'center' | How the popup lines up with the anchor along that side. start and end follow the reading direction. How the popover lines up with the trigger along that side. How it lines up with the trigger: start, center (default) or end. |
className | string | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
side | "top" | "bottom" | "left" | "right" · default 'bottom' | Which side of the anchor the popup opens on. Flips to the other side when there isn't room. Which side of the trigger the popover opens on. Which side of the trigger it opens on: bottom (default), top, left or right. |
It also takes the 290 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.
Without React
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/card.csscomponents/popups.csscomponents/tooltip.csscomponents/prose.cssparts/board.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
Autumn price listPDF · 2 pages
Link onSeen 14 times
On top of the page: states, do and don’t
States. Closed, opening (fades and rises), open, closing (fades before what it changed appears: afterClose). While open, focus is inside and Escape closes it; when it closes, focus goes back to what opened it.
Do
- Name every dialog, drawer and popover (
DialogTitle,DrawerTitle, oraria-label). - Use
AlertDialogfor anything that cannot be undone, with the action named on its button ("Delete 3 files"). - Use a
Draweron a phone for what aPopoverdoes on a computer.
Don't
- Don't open a dialog from a dialog; change what the open one shows instead.
- Don't put the only way to do something in a right-click menu or a tooltip.
- Don't use a toast for something the person must not miss: that is an
Alerton the page.