Popover
Floats content next to the element that opened it. Use `Popover.ButtonTrigger` or `Popover.IconButtonTrigger` so it stays accessible.
compliant
- Overview
- Props
- Figma
Usage
Accessibility
Primary triggers for accessibility: Use Popover.ButtonTrigger for accessible popovers with text
labels, or Popover.IconButtonTrigger for icon-only triggers. Both provide proper ARIA attributes and
keyboard navigation out of the box.
Placement
Closing
Popover always close when either:
- the trigger element is clicked again
- the user clicks outside of the popover
- the user presses the
Escapekey
It's also possible to close the popover from the inside, using the <Popover.Close /> component:
For more advanced use cases, you can use a controlled popover with the open prop.
Controlled
If you need to control the popover visibility (instead of it being controlled by clicking), you can use the open prop.
Custom styles
Popover comes with a default style, but it can be reset and overriden:
<Popover.Content
unstyled
sx={{ padding: "$px4", backgroundColor: "$indigo500", borderColor: "$indigo900", borderWidth: 3 }}
/>
The arrow can also be hidden:
<Popover.Content noArrow />
Focus trap
When opened, Popover will trap focus inside of it, so that the user can't tab outside of it.
Mobile
On mobile, Popover.Content will be displayed in a BottomSheet. Please note that the popover must be controlled in order to work on mobile.
Trigger Types
Popover.ButtonTrigger is the recommended trigger for accessibility purposes when you have text labels. It handles all ARIA attributes automatically and provides proper keyboard navigation.
For icon-only triggers, use Popover.IconButtonTrigger:
<Popover>
<Popover.IconButtonTrigger icon="Settings" aria-label="Open menu" />
<Popover.Content>Your content here</Popover.Content>
</Popover>
ButtonTrigger accepts all regular Button props and trigger props. IconButtonTrigger accepts all IconButton props and trigger props.
Adheres to the WAI-ARIA Dialog Pattern.
murray and murray/mobile.Popover props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| children* | ReactNode | |||
| disableFocus | TuiPopoverProps["disableFocus"] | Disable focus management when opening (e.g. hover-only menus) | ||
| hoverable | TuiPopoverProps["hoverable"] | Open on pointer hover (Floating UI safe polygon). Forwarded to Tamagui Popover. | ||
| keepChildrenMounted | TuiPopoverProps["keepChildrenMounted"] | |||
| onOpenChange | TuiPopoverProps["onOpenChange"] | Called when popover is opened or closed | ||
| open | TuiPopoverProps["open"] | When controlled, decide if popover should be visible or not | ||
| placement | TuiPopoverProps["placement"] | Popover placement relative to target element | ||
| resize | TuiPopoverProps["resize"] | Caps the content to the space left on screen once flipped, so a long list doesn't run off it. Forwarded to Tamagui Popover. The content's children need `flexShrink` to follow the cap. | ||
| title | string | Popover title, also used as the accessible name of the popover on web |
Undocumented props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-label | any |
PopoverTrigger props
No propsPopoverContent props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-label | stringundefined | Accessible name of the popover dialog. Defaults to the Popover `title`, then to the name of the trigger @platform web | ||
| aria-labelledby | stringundefined | Id of the element that names the popover dialog. Takes precedence over `aria-label` @platform web | ||
| children* | ReactNode | Content of the popover | ||
| disableFocusScope | booleanundefined | false | Disable auto-focus and focus trap. Only use this if you plan to handle focus in another way | |
| noArrow | booleanundefined | false | Remove the popover arrow element | |
| sx | PopoverContentSxundefined | Provide additional styles to the popover | ||
| unstyled | booleanundefined | !isWeb | Remove default styles |
PopoverClose props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| asChild | booleanundefined | |||
| children* | ReactNode | When clicked, will close the popover | ||
| sx | 2 possibilitiesundefinedWithThemeValues<Pick<StackStyleBase, "width">> |