--- title: Popover path: components/popover status: Alpha source: 'https://github.com/primer/css/tree/main/src/popover' bundle: popover --- Popovers are used to bring attention to specific user interface elements, typically to suggest an action or to guide users through a new experience. A popover consist of: - The block element, `.Popover`, which simply positions its content absolutely atop other body content. - The child element, `.Popover-message`, which contains the markup for the intended messaging and the visual "caret." In the examples below, `Popover-message`, in particular, uses a handful of utility classes to style it appropriately. And these are intended to demonstrate the default, go-to presentation for the popover's message. By default, the message's caret is centered on the top edge of the message. The `Popover-message` element also supports several modifiers. By default, the caret is shown on the top edge of the message, horizontally centered. To change the caret's position, use one of the following modifiers. - [`.Popover-message--bottom`](#bottom) Places the caret on the bottom edge of the message, horizontally centered. - [`.Popover-message--right`](#right): Places the caret on the right edge of the message, vertically centered. - [`.Popover-message--left`](#left): Places the caret on the left edge of the message, vertically centered. Each of these modifiers also support a syntax for adjusting the positioning the caret to the right, left, top, or bottom of its respective edge. That syntax looks like: - [`.Popover-message--bottom-left`](#bottom-left) - [`.Popover-message--bottom-right`](#bottom-right) - [`.Popover-message--left-bottom`](#left-bottom) - [`.Popover-message--left-top`](#left-top) - [`.Popover-message--right-bottom`](#right-bottom) - [`.Popover-message--right-top`](#right-top) - [`.Popover-message--top-left`](#top-left) - [`.Popover-message--top-right`](#top-right) Lastly, there is an added [`.Popover-message--large`](#large) modifier, which assumes a slightly wider popover message on screens wider than 544px. ### Notes The samples below include optional markup, like: - An outermost container that establishes stacking context (e.g. `position-relative`). - A choice piece of user interface (a button, in this case) to relate the popover to. - Use of the `Details` and `js-details` family of class names, which interact with JavaScript to demonstrate dismissal of the popover by clicking the nested "Got it!" button. ### Basic example Defaults to caret oriented top-center. ```html live title="Default (top-center)"

Popover heading

Message about this particular piece of UI.

``` ### Large example ```html live title="Large"

Popover heading

Message about this particular piece of UI.

``` ### Bottom ```html live title="Bottom"

Popover heading

Message about this particular piece of UI.

``` ### Bottom-right ```html live title="Bottom-right"

Popover heading

Message about this particular piece of UI.

``` ### Bottom-left ```html live title="Bottom-left"

Popover heading

Message about this particular piece of UI.

``` ### Left ```html live title="Left"

Popover heading

Message about this particular piece of UI.

``` ### Left-bottom ```html live title="Left-bottom"

Popover heading

Message about this particular piece of UI.

``` ### Left-top ```html live title="Left-top"

Popover heading

Message about this particular piece of UI.

``` ### Right ```html live title="Right"

Popover heading

Message about this particular piece of UI.

``` ### Right-bottom ```html live title="Right-bottom"

Popover heading

Message about this particular piece of UI.

``` ### Right-top ```html live title="Right-top"

Popover heading

Message about this particular piece of UI.

``` ### Top-left ```html live title="Top-left"

Popover heading

Message about this particular piece of UI.

``` ### Top-right ```html live title="Top-right"

Popover heading

Message about this particular piece of UI.

```