Popover

A floating panel that appears on demand, containing supplementary content or actions.

Basic usage

A controlled popover with a title, a description, and actions. Pass open and onOpenChange when an action inside should close it.

Explanation

An uncontrolled popover that explains a metric. It closes on Escape or a click outside. Widen it with className.

Form

A short form for a quick edit. Focus moves into the popover when it opens and returns to the trigger when it closes. align="start" lines it up with the trigger's left edge.

Usage

Popover.Content is 256px wide (w-64) with no horizontal padding. It aligns to the end of the trigger unless you pass align. Use Popover.Anchor to position the content against an element other than the trigger.

Popover.Root

open
boolean

Whether the popover is open

onOpenChange
(open: boolean) => void

Callback when the open state changes

defaultOpen
boolean

Default open state

Default: false

modal
boolean

Whether the popover should be modal

Default: false


Popover.Content

side
'top''right''bottom''left'

Preferred side of the trigger to render against

Default: bottom

sideOffset
number

Distance in pixels from the trigger

Default: 10

align
'start''center''end'

Alignment of the popover content

Default: end

alignOffset
number

Additional offset in pixels for the alignment

Default: -5

avoidCollisions
boolean

Whether the popover should avoid collisions with viewport edges

Default: true

collisionBoundary
ElementnullArray<Element>

Elements to use as collision boundaries

collisionPadding
numberPartial<Record<Side, number>>

Padding to add to collision boundaries

Default: 12

arrowPadding
number

Padding between the arrow and the edges of the popover

Default: 0

sticky
'partial''always'

Whether the popover should stick to the trigger

Default: partial

hideWhenDetached
boolean

Whether to hide the popover when the trigger becomes detached

Default: false

withRadixPortal
boolean

Render the content through a Radix Portal

Default: true

className
string

Additional CSS classes to apply to the popover content