Docs menu

Popover

A speech bubble with a candy tail. It lands like jelly out of whatever opened it, with two puffs where it sprang from and a spray of stars off the corner where its own star keeps twinkling. Close it and it leaves in a cloud. ぽんっ

Installation

❯ npx shadcn@latest add https://yan.moe/r/popover.json

Usage

tsx
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
tsx
<Popover>
  <PopoverTrigger asChild>
    <Button>Open</Button>
  </PopoverTrigger>
  <PopoverContent>Anything can go in here.</PopoverContent>
</Popover>

PopoverClose closes it from inside, and PopoverAnchor positions it against something other than the trigger. For other bursts, pass a recipe from Effects: <PopoverContent fx={fxRecipes.bubbles}>.

Accessibility

  • Built on Radix Popover: focus moves into the card when it opens and returns to the trigger on Escape or an outside click.
  • On a phone the card is never wider than the screen minus a 16px margin on each side.
  • With prefers-reduced-motion: reduce, the card appears without the bounce or the particles.

API

PropTypeDefault
intensity

Set on PopoverContent. kawaii: jelly landing, puffs, stars, a corner star and a cloud on close. subtle: fade in. off: just appear.

"kawaii" | "subtle" | "off""kawaii"
fx

Set on PopoverContent. Overrides for the burst when it opens (kawaii only).

BurstOptions-
hideArrow

Set on PopoverContent. Hide the tail that points at the trigger.

booleanfalse
side

Set on PopoverContent. Preferred side.

"top" | "right" | "bottom" | "left""bottom"
align

Set on PopoverContent. Alignment along that side.

"start" | "center" | "end""center"
sideOffset

Set on PopoverContent. Gap between trigger and bubble, in px.

number12