An element that pops up from another element over other content; it differs from a tooltip in that it is usually triggered via click instead of hover and can contain interactive elements.
Component
Popover
48 examples
Popover
Ant Design
Ant Financial
- React
- Code examples
- Accessibility issues
- Open source
Popover
Auro
Alaska Airlines
- Web Components
- Sass
- Code examples
- Usage guidelines
- Open source
Popover
Backpack
Skyscanner
- Mobile
- React
- Code examples
- Usage guidelines
- Open source
- Tone of voice
Popover
Base Web
Uber
- React
- CSS-in-JS
- Code examples
- Usage guidelines
- Open source
Popover
Bolt Design System
Pegasystems
- Sass
- Twig
- Web Components
- Code examples
- Tone of voice
- Open source
Popover
Bootstrap
- Sass
- Code examples
- Accessibility
- Open source
Popover
Carbon Design System
IBM
- React
- Vanilla JS
- Angular
- Vue
- Svelte
- Web Components
- Code examples
- Usage guidelines
- Open source
Popover
Cauldron
Deque
- React
- CSS
- Code examples
- Usage guidelines
- Accessibility
- Open source
Popover
Cedar
Recreational Equipment, Inc.
- Vue
- Sass
- CSS Modules
- Usage guidelines
- Code examples
- Open source
Popover
Chakra UI
- React
- CSS-in-JS
- Code examples
- Open source
Popover
Coral
Talend
- React
- Code examples
- Tone of voice
- Open source
Popover
Crayons
Freshworks
- Web Components
- Code examples
- Open source
Popover
Decathlon Design System
- CSS
- React
- Svelte
- Vue
- Web Components
- Usage guidelines
- Code examples
- Accessibility
- Open source
Popover
Dell Design System
- Vanilla JS
- Code examples
- Usage guidelines
Popover
eBay Playbook
- HTML
- React
- Code examples
Popover
Elastic UI framework
Elastic
- React
- Sass
- Code examples
- Open source
Popover
Elisa Design System
- React
- Usage guidelines
- Code examples
- Accessibility
Popover
Evergreen
Segment
- React
- Open source
Popover
Flowbite
- Tailwind CSS
- Open source
- Code examples
Popover
Forma 36
Contentful
- React
- CSS-in-JS
- Code examples
- Open source
Popover
Gestalt
Pinterest
- React
- CSS
- Code examples
- Open source
- Usage guidelines
PopoverEducational
Gestalt
Pinterest
- React
- CSS
- Code examples
- Open source
- Usage guidelines
Popover
Headless UI
Tailwind Labs
- React
- Vue
- Code examples
- Accessibility
- Open source
Popover
Instructure-UI
Instructure
- React
- CSS-in-JS
- Code examples
- Accessibility
- Open source
Popover
Lightning Design System
Salesforce
- React
- Code examples
- Usage guidelines
- Tone of voice
- Open source
Popover
Momentum Design
Cisco
- React
- Sass
- Code examples
- Usage guidelines
- Open source
Popover
Morningstar Design System
- Vue
- Usage guidelines
Popout
Nord Design System
Nordhealth
- Web Components
- Code examples
- Usage guidelines
Popover
Orbit
Kiwi.com
- React
- CSS-in-JS
- Usage guidelines
- Open source
- Code examples
- Tone of voice
Popover
Pajamas
GitLab
- Vue
- Usage guidelines
- Code examples
- Open source
Popover
Paste
Twilio
- React
- CSS-in-JS
- Usage guidelines
- Code examples
- Tone of voice
- Accessibility
- Open source
Popover
PatternFly
Red Hat
- React
- Sass
- Tone of voice
- Open source
- Usage guidelines
Popover
Polaris
Shopify
- React
- Code examples
- Usage guidelines
- Accessibility
- Tone of voice
- Open source
Popover
Porsche Design System
- Web Components
- Angular
- React
- Vue
- Code examples
- Open source
Popover
Primer
GitHub
- React
- Code examples
- Open source
Popover
Radix Primitives
WorkOS
- React
- Code examples
- Open source
Popover
Reakit
- React
- Code examples
- Open source
- Accessibility
Popover
Ruter Components
- React
- Code examples
- Unmaintained
Popout
Seeds
Sprout Social
- React
- Code examples
- Usage guidelines
- Tone of voice
Popover
shadcn/ui
- React
- Tailwind CSS
- Code examples
- Open source
Popover
Spectrum
Adobe
- CSS
- Web Components
- React
- Code examples
- Usage guidelines
- Tone of voice
- Open source
Popover
Stacks
Stack Overflow
- Stimulus
- Code examples
- Usage guidelines
- Tone of voice
- Open source
Popover
Thumbprint
Thumbtack
- React
- Sass
- Code examples
- Open source
Popover
Wanda
Wonderflow
- React
- CSS Modules
- Code examples
- Open source
Popover
Wise Design
- Mobile
- Usage guidelines
- Tone of voice
Description
A popover is a wrapper for content that floats above other elements on the page. It is shown or hidden by interacting (usually clicking, but can also be on focus or hover) with a trigger element such as a button. The popover appears above, below, or to one side of this trigger element, often with a small triangle linking the two elements.
Note: In some cases, such as in Headless UI, the popover can be used as a primitive component for building other components like navigation menus. This article does not cover that use case.
Example markup
Here is some example markup for a popover trigger and popover in its closed state:
<!-- Popover trigger -->
<button
type="button"
aria-expanded="false"
aria-controls="popover"
aria-haspopup="dialog"
>
Expand Popover
</button>
<!-- Popover -->
<div id="popover" role="dialog" hidden>
<button type="button">Close popover</button>
<header>This is the popover title</header>
<p>This is the popover body</p>
</div>
In the open state, set the aria-expanded
attribute on the popover trigger to false
and remove the hidden
attribute from the popover.
Interactivity
Opening the popover can be triggered using the click event on the button. This event will be triggered on mouse click, touch, and key press (Enter ↵ or Space).
The popover should be closed whenever the user does any of the following actions:
- Presses the Esc key
- Presses a close button in the popover
- Clicks outside of the popover
Accessibility
Ensure that users can open, navigate, and close the popover using only a keyboard:
- When focused on the trigger button, Enter ↵ or Space should toggle display of the popover
- When the popover is expanded, Esc should close the popover and return focus to the trigger button
Ensure the popover trigger has an accessible label and communicates the popover's state to assistive technologies:
- Use the
aria-expanded
attribute on the trigger to indicate visibility of the popover - If your trigger does not have a visible text label, provide an
aria-label
or visually hidden label - Use the
aria-haspopup
attribute on the trigger to indicate the type of interactive popup that this element triggers, usuallydialog
ormenu
; this should match therole
of the popover. You can see all possible values here. - Use
aria-controls
with the value set to theid
of the popover element
Ensure the popover content is hidden from assistive technologies when the popover is closed. Some possible ways of doing this include:
- Adding the
hidden
attribute - Adding the CSS property
display: none
orvisibility: hidden
- Adding the
inert
attribute - Adding the
aria-hidden="true"
attribute (you may also need to set any interactive elements inside the popover as non-focusable usingtabindex="-1"
)
Ensure the popover content has the correct attributes:
- The
id
should match thearia-controls
attribute of the popover trigger. - The
role
should match thearia-haspopup
attribute on the popover trigger.
A note on the dialog
role
If you're using the dialog
role on the popover, you need to decide whether the dialog is modal (only the content within the dialog can be interacted with) or non-modal (users can interact with content outside of the dialog).
For modal dialogs you will need to implement a focus trap to ensure that keyboard users can navigate through interactive elements in a logical and predictable order without inadvertently moving focus outside of the intended area.
Usage guidelines
Because a popover is hidden by default, it should only contain non-critical information. If you have space to show this information outside a popover without cluttering your interface, you should do so. One possible use for a popover is to hide information that's irrelevant once the user is familiar with an interface.
Keep the content inside your popovers short to prevent it being cut off on smaller screens (or needing an internal scrollbar).
The trigger for your popover should trigger your popover and nothing else. If you add popover functionality to an element which is already interactive (e.g. a link), the two actions will be triggered at the same time on touch devices. This might work for desktop users – those with a mouse or touchpad – but on touch devices, the focus, hover, and active states happen simultaneously.
Future developments
Since version 114, Chromium (the browser engine for Chrome and Edge amongst others) has included a Popover API designed to simplify the process of implementing popover components. This introduces new popovertarget
and popover
attributes.
<!-- Popover trigger -->
<button popovertarget="popover">Open Popover</button>
<!-- Popover -->
<div popover id="popover">Popover content</div>
The popover element is given the popover
attribute and an id
. The popover trigger is given the popovertarget
attribute with its value matching the id
of the popover element. Clicking on the popover trigger will now toggle the visibility of the popover element without any custom JavaScript.
Popovers created using the popover API are always non-modal.
At the time of writing, this is still an experimental technology so should not be used in production. Check the caniuse page for current browser support.
Related components
Tooltip
75Â examples
Other names: Toggletip
A means of displaying a description or extra information about an element, usually on hover, but can also be on click or tap.
Dropdown menu
53Â examples
Other names: Select menu
A menu in which options are hidden by default but can be shown by interacting with a button; it differs from a select in that it shows actions or navigation options and is not a form input.