A Popover can be used to display some content when user clicks on another element.
placement
offset
isKeyboardDismissDisabled
1<Popover>
2 <Popover.Trigger>
3 Click me to open the popover
4 </Popover.Trigger>
5 <Popover.Content>
6 Hello, I'm the content!
7 </Popover.Content>
8</Popover>1<Popover>
2 <Popover.Trigger></Popover.Trigger>
3 <Popover.Content></Popover.Content>
4</Popover>npm install @rootui/popover1import { Popover } from "@rootui/popover";
2
3export default function Page() {
4 return (
5 <Popover>
6 <Popover.Trigger>I'm the trigger</Popover.Trigger>
7 <Popover.Content>I'm the content</Popover.Content>
8 </Popover>
9 )
10}See the React Aria documentation for more information.
Prop | Type | Default |
|---|---|---|
| | |
Whether the popover is open by default (controlled). | ||
| | |
Whether the popover is open by default (uncontrolled). | ||
| | |
Handler that is called when the popover's open state changes. | ||
| | |
Prop | Type | Default |
|---|---|---|
| | |
Prop | Type | Default |
|---|---|---|
| | |
The placement of the element with respect to its anchor element. | ||
| | |
| | |
| | |
| | |
Whether the popover content (overlay) should update its position automatically. | ||
| | |
The maxHeight specified for the overlay element. By default, it will take all space up to the current viewport height. | ||
| | |
Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies. Most popovers should not use this option as it may negatively impact the screen reader experience. Only use with components such as combobox, which are designed to handle this situation carefully. | ||
| | |
Whether pressing the escape key to close the popover should be disabled. | ||
| | |
Whether the overlay is open by default (controlled). | ||
| | |
Whether the overlay is open by default (uncontrolled). | ||
| | |
| | |
Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely. | ||
| | |
The additional offset applied along the main axis between the element and its anchor element. | ||
| | |
The additional offset applied along the cross axis between the element and its anchor element. | ||
Attribute | Description |
|---|---|
| The name of the component that triggered the popover, e.g. "DialogTrigger" or "ComboBox". |
| The placement of the popover relative to the trigger. |
| Whether the popover is currently entering. Use this to apply animations. |
| Whether the popover is currently exiting. Use this to apply animations. |
CSS variable | Description |
|---|---|
| The width of the popover trigger element. |
| The position of the trigger relative to the popover. Use with transform-origin when applying scale transitions. |