Skip to main content

Popover

StorybookView in Storybook

Explore interactive examples and all component variations in our Storybook.

The Popover component displays rich content in a floating panel anchored to a trigger element. Built on Radix UI, it provides flexible positioning, focus management, and accessibility features. Perfect for tooltips, menus, forms, and contextual information.

Basic Usage​

With Form​

User Profile Popover​

Information Popover​

Positioning​

Notification Popover​

Context Menu Popover​

Project Alpha

Last updated 2 hours ago

Properties​

Popover​

PropertyTypeDescription
childrenReactNodePopover trigger and content components.
defaultOpenbooleanWhether the popover is open by default.
openbooleanControlled open state.
onOpenChange(open: boolean) => voidCallback when open state changes.

PopoverTrigger​

PropertyTypeDescription
asChildbooleanRender as child element instead of button.
childrenReactNodeTrigger element content.

PopoverContent​

PropertyTypeDefaultDescription
side"top" | "right" | "bottom" | "left""bottom"Preferred side to render the popover.
align"start" | "center" | "end""center"Alignment relative to the trigger.
sideOffsetnumber4Distance from the trigger element.
alignOffsetnumber0Offset along the alignment axis.
avoidCollisionsbooleantrueWhether to avoid viewport collisions.
collisionBoundaryElement | Element[]-Boundary elements for collision detection.
sticky"partial" | "always""partial"Sticky behavior when scrolling.
hideWhenDetachedbooleanfalseHide when trigger becomes detached.
classNamestring-Additional CSS classes.
childrenReactNode-Popover content.

PopoverAnchor​

PropertyTypeDescription
asChildbooleanRender as child element.
childrenReactNodeAnchor element content.

Accessibility​

The Popover component includes comprehensive accessibility features:

  • Keyboard Navigation - Full keyboard support with Escape to close
  • Focus Management - Automatic focus handling and restoration
  • Screen Reader Support - Proper ARIA attributes and announcements
  • Portal Rendering - Renders in document body to avoid z-index issues
  • Collision Detection - Automatically repositions to stay in viewport
  • Dismissible - Closes on outside click and Escape key

Common Use Cases​

The Popover component is perfect for:

  • Context Menus - Right-click or action menus for items
  • User Profiles - Quick profile information and actions
  • Notifications - Notification panels and activity feeds
  • Forms - Inline editing and quick input forms
  • Help & Info - Contextual help and information tooltips
  • Settings - Quick settings and preference panels
  • Navigation - Dropdown menus and navigation options

Best Practices​

  1. Appropriate Triggers - Use clear, accessible trigger elements
  2. Content Size - Keep content concise and scannable
  3. Positioning - Choose appropriate side and alignment for context
  4. Mobile Considerations - Ensure popovers work well on touch devices
  5. Focus Management - Test keyboard navigation and focus restoration
  6. Performance - Avoid heavy content that might cause layout shifts
  7. Collision Handling - Let the component handle viewport collisions automatically
  8. Consistent Styling - Maintain consistent popover styling across your app