Popover

Popover opens a small panel next to its trigger with richer content than a tooltip. Use it for previews, definitions and quick settings.

  • Beta
  • Accessibility
  • Figma None (code-only; surface from menus 125:12801, arrow from Tooltip 269:7370)
  • packages/ui/src/components/Popover

Beta until design adds a popover to Figma. The component is code-only: its surface comes from the menus and its arrow from the tooltip. Everything on this page is implemented and tested.

Preview

Change the controls, then select the underlined term. The popover opens on click, not on hover.

Plants capture light with .

tsx
import { LinkButton, Popover, PopoverContent, PopoverTrigger } from '@nuton/ui'

<Popover>
  <PopoverTrigger asChild>
    <LinkButton tone="black" underline>chlorophyll</LinkButton>
  </PopoverTrigger>
  <PopoverContent
    title="Chlorophyll"
    description="Biology · Glossary"
  >
    <p>The green pigment in plants that absorbs light for photosynthesis.</p>
  </PopoverContent>
</Popover>

Installation

Availability

@nuton/ui and @nuton/tokens are private workspace packages and aren't published yet (D4, D12). Inside the Nuton monorepo, add them as workspace dependencies.

bash
pnpm add @nuton/ui @nuton/tokens @remixicon/react
tsx
import '@nuton/tokens/tokens.css'
import '@nuton/ui/styles.css'

Usage

tsx
import { Button, Popover, PopoverContent, PopoverTrigger } from '@nuton/ui'

<Popover>
  <PopoverTrigger asChild><Button appearance="stroke">Source 1</Button></PopoverTrigger>
  <PopoverContent title="Campbell Biology, chapter 10" description="Photosynthesis · page 187">
    <p>The light reactions convert solar energy to chemical energy.</p>
  </PopoverContent>
</Popover>
  • The trigger must be a button. Use asChild with a Button or LinkButton so it is focusable and announces its expanded state.
  • Give it a title; it names the popover. Without one, pass aria-label.
  • Keep content short. If it needs scrolling, forms or several steps, use a Sheet or Modal.
  • For a short label on hover, use a Tooltip. For a list of commands, use a Dropdown menu.

Variants and sizes

Two widths, an optional arrow, and any side and alignment. The popover flips or shifts to stay on screen.

Sizes

SizeWidthUse for
sm (default)280 (the menu minimum width)Glossary terms, short notes, quick settings
md360Source and citation previews

Anatomy and measurements

PartMeasurement
SurfaceBg/White, 1px Stroke/Soft-200, radius 16, regular-shadow/medium (as menus); padding 16, gap 12 (code-only)
Title · descriptionLabel/Small Strong-950 · Paragraph/Small Sub-600, 4 apart
BodyParagraph/Small, items 12 apart
Close24 × 24 target with a 16px icon, 12 from the top and end, centred on the title line
Arrow12 × 6 (the Tooltip tail), at least 16 from a corner; 4px gap to the trigger plus the arrow

States and interactions

Chlorophyll

The green pigment that absorbs light.

OpenScales and fades in over the fast duration. Focus moves to the first control inside, or the close button.

Playback speed

No close button: Escape and an explicit Done close it.

Without close buttonshowClose={false}. Escape and a click outside always close it.

State tokens

Set on .nu-popover: --nu-popover-width, --nu-popover-pad, --nu-popover-close-size and --nu-popover-bg (also used by the arrow fill).

Code-only component

Figma has no popover. The surface, arrow and close button reuse the menu, tooltip and alert specs. Padding 16, the two widths and the focus ring are code-only and need design review.

Composition examples

Citation preview in an AI Tutor answer

The light reactions take place in the thylakoid membranes and produce ATP and NADPH

Quick settings

API reference

PopoverContent props

PopoverContent props
PropTypeDefaultDescription
titleReactNode—Heading (h2, Label/Small). Names the popover with aria-labelledby.
descriptionReactNode—Text under the title (Sub-600). Wired to aria-describedby.
size'sm' | 'md''sm'280 or 360 wide; shrinks to fit the screen.
arrowbooleanfalseShows the 12 × 6 pointer. A popover with an arrow does not scroll, so keep it short.
showClosebooleantrueShows the close button in the top corner.
closeLabelstring'Close'Accessible name of the close button.
side · align'top' | 'right' | 'bottom' | 'left' · 'start' | 'center' | 'end''bottom' · 'center'Preferred placement. It flips or shifts to stay on screen.
sideOffset · collisionPaddingnumber4 (+6 with arrow) · 8Distance from the trigger and from the screen edge.
containerHTMLElement—Portal container. Defaults to document.body.
…Radix propsPopover.Content—onEscapeKeyDown, onOpenAutoFocus, aria-label and others. The ref points at the panel.

Popover takes open, defaultOpen, onOpenChange and modal. PopoverTrigger, PopoverClose and PopoverAnchor take asChild.

Accessibility

Keyboard

KeyBehaviour
Enter / SpaceOpens or closes it from the trigger
TabMoves through the content; leaving it keeps it open
EscCloses it and returns focus to the trigger

Screen readers

The trigger announces its expanded state and controls the panel. The panel is a non-modal dialog named by its title and described by its description.

Focus

Focus moves into the panel on open and back to the trigger on close. The close button is last in the tab order and shows a 2px primary ring.

Contrast and colour

Title 17.93:1 and description 6.69:1 on white. The 1px border and shadow separate it from the page; forced-colours mode draws a system border.

Touch and pointer

Opens on tap or click, never on hover alone. The close button is 24 × 24 (WCAG 2.5.8); a tap outside also closes it.

You must: use a real button as the trigger, and give the popover a title or an aria-label.

Guidelines and related components

Use Popover for

  • Previewing a source or citation
  • Defining a glossary term in a lesson
  • A few quick settings

Don't use Popover for

  • Short labels on hover (use Tooltip)
  • Lists of commands (use Dropdown menu)
  • Long forms or tasks (use Sheet or Modal)

Do and don't

Chlorophyll

The green pigment that absorbs light for photosynthesis.

DoKeep it to a short preview People read it in place and carry on.

Create a space

Name, subject, members, privacy, cover image, description…

Don'tFit a whole form inside Long content scrolls in a small box and is easy to lose with one click outside.

Campbell Biology, ch. 10

Photosynthesis · page 187

DoGive it a title The title names the dialog for screen readers.

Opens when you point at the word…

Don'tOpen it on hover Hover doesn't work on touch, and content with links needs a deliberate click.