Popover

Popover is a component that floats around an element to display information.

Usage

import { Popover } from "@yamada-ui/react"
<Popover.Root>
  <Popover.Anchor />
  <Popover.Trigger />
  <Popover.Content>
    <Popover.Header />
    <Popover.Body />
    <Popover.Footer />
  </Popover.Content>
</Popover.Root>

Change Size

Display Popover on Different Element

To display a popover on a different element, use Popover.Anchor.

Here Display Popover

Change Animation

To change the animation, set animationScheme to "block-start", "inline-end", etc. By default, "scale" is set.

Change Placement

To change the placement, set placement to "start", "end-end", etc. By default, "end" is set.

Change Duration

To change the duration, set duration to a number (seconds).

Change Offset

To change the offset, set gutter or offset to a value.

Use Modal

To use modal, set modal to true. This enables scroll blocking and focus trapping.

Disable

To disable the popover, set disabled to true.

Disable Close on Outside Click

To disable closing when clicking outside, set closeOnBlur to false.

Disable Close on ESC Key

To disable closing when pressing the ESC key, set closeOnEsc to false.

Disable Auto Focus

To disable automatic focus when the popover opens, set autoFocus to false.

Set Initial Focus

To set the initial focus, pass a Ref to initialFocusRef.

Block Scroll

To block scrolling while the popover is open, set blockScrollOnMount to true.

Close on Scroll

To automatically close the popover when scrolling, set closeOnScroll to true.

Nest Popovers

Control

Props

Accessibility

The Popover follows the WAI-ARIA - Dialog (Modal) Pattern for accessibility.

Keyboard Navigation

KeyDescriptionState
TabFocuses the next element within the popover that is not disabled. If it's the last element, the popover is closed.open={true}
Shift + TabFocuses the previous element within the popover that is not disabled. If it's the first element, the popover is closed.open={true}
EscapeCloses the popover.open={true} + closeOnEsc={true}

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
Popover.Contentrole="dialog"Indicates that it is a dialog.
idUsed to associate with Popover.Trigger.
aria-labelledbySets the id of the associated Popover.Header.
aria-describedbySets the id of the associated Popover.Body.
aria-hiddenSets to "false" when popover is opened, and "true" when it is closed.
aria-modalSets to "true" when modal={true}.
Popover.Triggerrole="button"Indicates that it is a button.
aria-disabledSets to "true" when disabled={true}.
aria-expandedSets to "true" when popover is opened, and "false" when it is closed.
aria-controlsSet to Popover.Content's id when popover is opened, and undefined when it is closed.
aria-haspopup="dialog"Indicates that it triggers a dialog.
Popover.HeaderidUsed to associate with Popover.Content.
Popover.BodyidUsed to associate with Popover.Content.

Similar Components

Tooltip

Tooltip is a component that displays short information, such as supplementary details for an element.

Drawer

Drawer is a component for a panel that appears from the edge of the screen.

Modal

Modal is a component that is displayed over the main content to focus the user's attention solely on the information.

NativePopover

NativePopover is a component that floats around an element to display information using the HTML Popover API.

Menu

Menu is a component that displays a common dropdown menu.

Uses Components & Hooks

Used By Components & Hooks