Skip to the page
Supply UI

Popover

A small panel that opens from a button and holds content or controls: a filter, a short form, details

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>

This page as text, for an AI

Options

No options of its own.

It also takes the 16 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.

Parts

What goes inside one.

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.css

In 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
Share with a link A popover with the switch and the link to copy

On top of the page: states, do and don’t

A small panel next to its button. It spaces what is put in it, like a dialog: put rows, fields and buttons straight inside.

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, or aria-label).
  • Use AlertDialog for anything that cannot be undone, with the action named on its button ("Delete 3 files").
  • Use a Drawer on a phone for what a Popover does 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 Alert on the page.