Popover
Unfolds from the button that opened it, then its contents cascade in.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/popoverThis adds components/keyframery/popover.tsx and its primitive to your project, and installs UI SDK. The motion tokens are added to your global CSS the first time you install a component.
Usage
import { Popover, PopoverContent, PopoverTrigger } from "@/components/keyframery/popover"
export default function Usage() {
return (
<Popover>
<PopoverTrigger>Open</PopoverTrigger>
<PopoverContent>Content</PopoverContent>
</Popover>
)
}Anatomy
How the parts fit together:
Popover
├── PopoverTrigger
└── PopoverContentExamples
With a title and a form
A popover holds interactive content. Focus moves into it, and Escape or a click outside closes it.
Placement
side and align choose where it opens. It flips by itself when there isn't room.
Open on hover
openOnHover opens it while the pointer rests on the trigger, after delay. A click still opens it too.
Motion
| Move | What you see |
|---|---|
| Unfold | The popover unfolds from the button that opened it. |
| Cascade | Its contents arrive one after another. |
Timing and springiness follow the motion style you set. To change how fast this popover moves, pass speed:
<Popover speed="fast">
…
</Popover>"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.
Theming
Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.
| Variable | What it changes | Default |
|---|---|---|
--popover-surface | Sheet and arrow | --popover |
--popover-ink | Sheet text | --popover-foreground |
--popover-muted | Description and shortcut text | --muted-foreground |
--popover-key | Trigger and default close surface | --background, --accent in dark |
--popover-primary | Primary close surface | --primary |
--popover-width | Sheet width | 18rem |
--popover-radius | Sheet corners | 14px |
--popover-padding | Sheet padding | 1rem |
API reference
Every part takes className and children. Parts from UI SDK also take render, to draw your own element, and a function of their state for className and style. Props not listed here are in the UI SDK popover reference.
Popover
Prop
Type
PopoverTrigger
Renders a <button>, and takes its props too.
Prop
Type
PopoverContent
Renders a <div>, and takes its props too.
Prop
Type
PopoverClose
Renders a <button>, and takes its props too.
Prop
Type
PopoverShortcut
Renders a <span>, and takes its props too.
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
PopoverArrow: a<div>PopoverDescription: a<p>PopoverTitle: a<h2>
Keyboard
| Key | What it does |
|---|---|
| Enter | Opens the popover from its trigger. |
| Tab | Moves through the popover's controls. |
| Escape | Closes the popover and returns focus to the trigger. |
Accessibility
Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. More in Accessibility.
Swap the import
Already using UI SDK's popover with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.
// Before
import { … } from "@ui-sdk/react/popover"
// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/popover"Questions
How does the animated Popover for UI SDK move?
Unfold: The popover unfolds from the button that opened it. Cascade: Its contents arrive one after another.
Do I need Motion or Framer Motion for the animated Popover?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
Can I keep my own styling and only take the motion?
Yes. Import from @/components/keyframery/primitives/popover instead. It has the same parts and props as @ui-sdk/react/popover and adds motion only.
What happens to the Popover when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.