Skip to content
Patternfly Logo

Popover

Examples

Top

Popover header

Popovers are triggered by click rather than hover. Click again to close.
Popover footer

Popover header

Popovers are triggered by click rather than hover. Click again to close.
Popover footer

Bottom

Popover header

Popovers are triggered by click rather than hover. Click again to close.
Popover footer

Left

Popover header

Popovers are triggered by click rather than hover. Click again to close.
Popover footer

Left with top and bottom positions

Popover header

This popover is to the left and at the start position
Popover footer

Popover header

This popover is to the left and at the end position
Popover footer

Bottom with left and right positions

Popover header

This popover is to the bottom and at the start position
Popover footer

Popover header

This popover is to the bottom and at the end position
Popover footer

Without header/footer

Popovers are triggered by click rather than hover. Click again to close.

No padding

This popover has no padding and is intended for use with content that has its own spacing and should touch the edges of the popover container.

Width auto

Popover header

Popovers body
Popover footer

Documentation

Overview

A popover is used to provide contextual information for another component on click. The popover itself is made up of two main elements: arrow and content. The content element follows the pattern of the popover box component, with a close icon in the top right corner, as well as a header and body. One of the directional modifiers (.pf-m-left, .pf-m-top, etc.) is required on the popover component

Accessibility

Attribute
Applies to
Outcome
role="dialog"
.pf-c-popover
Identifies the element that serves as the popover container. Note: role="dialog" is not included on the static examples on this page as it interferes with VoiceOver. Refer to the react examples to see the role in use. Required
aria-labelledby="[id value of .pf-c-title]"
.pf-c-popover
Gives the popover an accessible name by referring to the element that provides the dialog title. Required when .pf-c-title is present
aria-label="[title of popover]"
.pf-c-popover
Gives the popover an accessible name. Required when .pf-c-title is not present
aria-describedby="[id value of applicable content]"
.pf-c-popover
Gives the popover an accessible description by referring to the popover content that describes the primary message or purpose of the dialog. Not used if there is no static text that describes the popover.
aria-modal="true"
.pf-c-popover
Tells assistive technologies that the windows underneath the current popover are not available for interaction. Required
aria-label="Close"
.pf-c-button
Provides an accessible name for the close button as it uses an icon instead of text. Required
aria-hidden="true"
Parent element containing the page contents when the popover is open.
Hides main contents of the page from screen readers. The element with .pf-c-popover must not be a descendent of the element with aria-hidden="true". For more info, see trapping focus. Required

Usage

Class
Applied to
Outcome
.pf-c-popover
<div>
Creates a popover. Always use it with a modifier class that positions the popover relative to the element that triggered it. Required
.pf-c-popover__arrow
<div>
Creates an arrow pointing towards the element the popover describes. Required
.pf-c-popover__content
<div>
Creates the content area of the popover. Required
.pf-c-button
<button>
Positions the close icon in the top-right corner of the popover. Required
.pf-c-title
<h1>,<h2>,<h3>,<h4>,<h5>,<h6>
Initiates a title. Always use it with a modifier class. See the title component for more info.
.pf-c-popover__body
<div>
The popover's body text. Required
.pf-c-popover__footer
<footer>
Initiates a popover footer.
.pf-m-left{-top/bottom}
.pf-c-popover
Positions the popover to the left (or left top/left bottom) of the element.
.pf-m-right{-top/bottom}
.pf-c-popover
Positions the popover to the right (or right top/right bottom) of the element.
.pf-m-top{-left/right}
.pf-c-popover
Positions the popover to the top (or top left/top right) of the element.
.pf-m-bottom{-left/right}
.pf-c-popover
Positions the popover to the bottom (or bottom left/bottom right) of the element.
.pf-m-no-padding
.pf-c-popover
Removes the outer padding from the popover content.
.pf-m-width-auto
.pf-c-popover
Allows popover width to be defined by the popover content.

CSS variables

.pf-c-popover--pf-c-popover--FontSize
0.875rem
.pf-c-popover--pf-c-popover--MinWidth
calc(1rem + 1rem + 18.75rem)
.pf-c-popover--pf-c-popover--MaxWidth
calc(1rem + 1rem + 18.75rem)
.pf-c-popover--pf-c-popover--BoxShadow
0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)
.pf-c-popover--pf-c-popover__content--BackgroundColor
#fff
.pf-c-popover--pf-c-popover__content--PaddingTop
1rem
.pf-c-popover--pf-c-popover__content--PaddingRight
1rem
.pf-c-popover--pf-c-popover__content--PaddingBottom
1rem
.pf-c-popover--pf-c-popover__content--PaddingLeft
1rem
.pf-c-popover--pf-c-popover__arrow--Width
1.5625rem
.pf-c-popover--pf-c-popover__arrow--Height
1.5625rem
.pf-c-popover--pf-c-popover__arrow--BoxShadow
0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)
.pf-c-popover--pf-c-popover__arrow--BackgroundColor
#fff
.pf-c-popover--pf-c-popover__arrow--m-top--TranslateX
-50%
.pf-c-popover--pf-c-popover__arrow--m-top--TranslateY
50%
.pf-c-popover--pf-c-popover__arrow--m-top--Rotate
45deg
.pf-c-popover--pf-c-popover__arrow--m-right--TranslateX
-50%
.pf-c-popover--pf-c-popover__arrow--m-right--TranslateY
-50%
.pf-c-popover--pf-c-popover__arrow--m-right--Rotate
45deg
.pf-c-popover--pf-c-popover__arrow--m-bottom--TranslateX
-50%
.pf-c-popover--pf-c-popover__arrow--m-bottom--TranslateY
-50%
.pf-c-popover--pf-c-popover__arrow--m-bottom--Rotate
45deg
.pf-c-popover--pf-c-popover__arrow--m-left--TranslateX
50%
.pf-c-popover--pf-c-popover__arrow--m-left--TranslateY
-50%
.pf-c-popover--pf-c-popover__arrow--m-left--Rotate
45deg
.pf-c-popover--pf-c-popover--c-button--MarginLeft
0.5rem
.pf-c-popover--pf-c-popover--c-button--Top
calc(1rem - 0.375rem)
.pf-c-popover--pf-c-popover--c-button--Right
1rem
.pf-c-popover--pf-c-popover--c-button--sibling--PaddingRight
3rem
.pf-c-popover--pf-c-popover--c-title--MarginBottom
0.5rem
.pf-c-popover--pf-c-popover__footer--MarginTop
1rem
.pf-c-popover.pf-m-no-padding--pf-c-popover__content--PaddingTop
0px
.pf-c-popover.pf-m-no-padding--pf-c-popover__content--PaddingRight
0px
.pf-c-popover.pf-m-no-padding--pf-c-popover__content--PaddingBottom
0px
.pf-c-popover.pf-m-no-padding--pf-c-popover__content--PaddingLeft
0px
.pf-c-popover.pf-m-width-auto--pf-c-popover--MinWidth
auto
.pf-c-popover.pf-m-width-auto--pf-c-popover--MaxWidth
none

View source on GitHub