Talisman LogoTalisman Logo Design System
Browse documentation
Components

Popover

A floating panel anchored to a trigger and opened by click, for details or a small form that does not need a full dialog.

Stableimport { Popover } from "@repo/ui/popover";Source

Select the button to open the panel. Press Escape or select outside to close it.

When to use

  • To show details tied to one element, such as the full deadline behind a date.
  • For a small form of one to three fields, such as renaming a task.
  • To hold a short list of actions or a picker that does not deserve a page.
  • When the content has links or buttons. A Tooltip cannot hold them.

When not to use

  • A one-line name for an icon button. Use Tooltip.
  • Decisions that stop the flow, or long forms. Use Dialog.
  • A list of actions or commands. Use a dropdown menu, or Button menu.
  • Choosing one value from a list. Use Select, or Combobox when the list needs search.
  • Confirmation of an action. Use a toast (Sonner).

Anatomy

Part Role
Popover Holds the open state.
PopoverTrigger The element that opens it. Use asChild with a Button.
PopoverContent The panel. Set its width with className, for example w-72.
PopoverAnchor Optional. Anchors the panel to another element than the trigger.

Variants

variant Use for
surface Default. A light panel with border and shadow, for content and forms.
inverse A dark panel for short tips. Opt in; prefer a Tooltip for one-line labels.

Examples

With a form

With an arrow

showArrow adds a small pointer to the trigger. Use it when the panel sits far from the trigger or among many similar elements.

Content

  • Start with a short title in Typography (“Prazo da contestação”), then one or two sentences.
  • Keep it under about 40 words. For more, use a page or a dialog.
  • Buttons name the action: “Salvar nome”, “Confirmar”. The main action goes last.
  • Do not open the popover on hover. It opens on click.

Do and don’t

DoUse a popover when the user acts on the content.
Don'tDon't open a panel for a one-line label. Use a Tooltip.

Accessibility

  • Built on Radix Popover. The trigger is a button with aria-expanded and aria-controls that point to the panel; Enter and Space open it.
  • Focus moves into the panel on open and returns to the trigger on close. Escape and selecting outside close it.
  • Tab moves inside the panel in order. The panel is not modal by default (modal={false}), so focus can leave it and it closes.
  • Pass modal to Popover to trap focus, for panels with a form that must not be left by accident.
  • Radix does not name the panel. If it has no visible title, give PopoverContent an aria-label.
  • The arrow is aria-hidden.

Code

import { Button } from "@repo/ui/button";
import { Popover, PopoverContent, PopoverTrigger } from "@repo/ui/popover";
import { Typography } from "@repo/ui/typography";

<Popover>
  <PopoverTrigger asChild>
    <Button size="sm" variant="secondary">
      Detalhes do prazo
    </Button>
  </PopoverTrigger>
  <PopoverContent className="w-72">
    <Typography variant="labelMd">Prazo da contestação</Typography>
    <Typography variant="paragraphSm">Vence em 02/04/2025.</Typography>
  </PopoverContent>
</Popover>;

Props

Popover
PropTypeDefaultDescription
defaultOpenbooleanfalseInitial open state when the popover is uncontrolled
modalbooleanfalseBlocks interaction with the rest of the page while open
onOpenChange(open: boolean) => void—Called when the popover opens or closes
openboolean—Controlled open state
PopoverContent
PropTypeDefaultDescription
variant"surface" | "inverse""surface"Visual style of the panel and its arrow.
side"top" | "right" | "bottom" | "left""bottom"Preferred edge. It flips when there is no room.
align"start" | "center" | "end""center"Alignment along the chosen edge.
sideOffsetnumber8Distance in pixels from the trigger.
showArrowbooleanfalseShows the arrow that points to the trigger.
containerHTMLElement | null—Node to render the panel into, for example the content of a dialog.
PopoverTrigger
PropTypeDefaultDescription
asChildbooleanfalseUses the child element as the trigger instead of a button.

Known issues

Issue Effect
The surface shadow is a hardcoded rgba(0,0,0,0.15) value. It does not come from a token, so it cannot change per theme.
The panel animates with animate-in/animate-out and has no motion-reduce variant. The fade and zoom play for users who asked for reduced motion.
PopoverContent is z-[100] and TooltipContent is z-50. A tooltip inside a popover renders behind it.
The surface arrow is a plain fill in the panel color, with no border. Next to the bordered panel, the arrow has no outline and looks detached on a light page.
Edit this page on GitHub