The Popover component is a small overlay that displays additional content or information when triggered by a user action, such as clicking or hovering over an element. It provides contextual information or interactive elements without navigating away from the current page. This component enhances user experience by delivering relevant content in a non-intrusive, easily accessible manner.
Use usePopover, Popover, Popover.Content and Popover.Trigger to create a simple Popover.
Use Popover.Title props to create a predefined title block.
withCloseButton show close button.
You can have a hover on Popover with PopoverHover and usePopoverHover from Popover.
We use usePopoverStore from Ariakit Popover for the state of the Popover and useHovercardStore from Ariakit Hovercard for the state of the PopoverHover.
Pass options to usePopover or usePopoverHover:
- defaultOpen: e.g.
const popover = usePopover({ defaultOpen: true })
- withCloseButton:
bool, show/hide cross to close popover
When you use usePopoverHover you can change:
- showTimeout:
number by default to 500, show after x milliseconds on hover the trigger
- hideTimeout:
number by default to 300, close after x milliseconds on mouse lease popover
And the hook returns (among other things):
- useState('open'): whether the popover is currently open
- hide: a function to hide the popover