Popover
Displays rich content in a portal, triggered by a button.
When To Use
- When you need a temporary floating container to display additional context or interactive controls
- For forms that don't require a full page or modal
- To provide a lightweight interface for auxiliary information
- When you want to display contextual information without disrupting the user's current context
- As an alternative to tooltips when more interactive content is needed
Examples
Basic
A basic popover with a trigger button and content.
With Form
A popover containing a simple form.
With Arrow
A popover with a visual arrow pointing to the trigger.
Custom Positioning
A popover with custom positioning and alignment.
Props
Popover
| Prop | Type | Default |
|---|---|---|
modal? | boolean | - |
onOpenChange? | ((open: boolean) => void) | - |
defaultOpen? | boolean | - |
open? | boolean | - |
PopoverTrigger
| Prop | Type | Default |
|---|---|---|
asChild? | boolean | - |
value? | string | number | readonly string[] | - |
type? | "button" | "submit" | "reset" | - |
name? | string | - |
formTarget? | string | - |
formNoValidate? | boolean | - |
formMethod? | string | - |
formEncType? | string | - |
formAction? | string | ((formData: FormData) => void | Promise<void>) | - |
disabled? | boolean | - |
key? | Key | null | - |
form? | string | - |
PopoverContent
| Prop | Type | Default |
|---|---|---|
forceMount? | true | - |
onCloseAutoFocus? | ((event: Event) => void) | - |
onOpenAutoFocus? | ((event: Event) => void) | - |
onInteractOutside? | ((event: PointerDownOutsideEvent | FocusOutsideEvent) => void) | - |
onFocusOutside? | ((event: FocusOutsideEvent) => void) | - |
onPointerDownOutside? | ((event: PointerDownOutsideEvent) => void) | - |
onEscapeKeyDown? | ((event: KeyboardEvent) => void) | - |
updatePositionStrategy? | "always" | "optimized" | - |
hideWhenDetached? | boolean | - |
sticky? | "partial" | "always" | - |
collisionPadding? | number | Partial<Record<"top" | "right" | "bottom" | "left", number>> | - |
collisionBoundary? | Boundary | Boundary[] | - |
avoidCollisions? | boolean | - |
arrowPadding? | number | - |
alignOffset? | number | - |
align? | "center" | "start" | "end" | - |
sideOffset? | number | - |
side? | "top" | "right" | "bottom" | "left" | - |
asChild? | boolean | - |
key? | Key | null | - |
PopoverAnchor
| Prop | Type | Default |
|---|---|---|
virtualRef? | RefObject<Measurable> | - |
asChild? | boolean | - |
key? | Key | null | - |
Accessibility
The Popover component adheres to the WAI-ARIA Dialog Pattern.
- The popover trigger has
aria-expandedset totrueorfalsedepending on the popover state. - When open, the popover content has
aria-modalset totrue. - Focus is trapped within the popover when open for keyboard users.
- Escape key dismisses the popover.
- The popover has a close button for accessibility.
- ARIA roles, states, and properties are appropriately applied to ensure screen reader compatibility.