Popovers are used for any contextual content that shouldn't block the the user. Some common uses are dropdown link menus, hovercards, complex tooltips, etc. Below are some guidelines for usage and structure.
Basic Usage
A popover, in its most basic form, looks like this.
Broken down; the first line creates the popover container. This is where the triggering method must also be declared: click or hover. In this example, it is declared as click.
The next line creates the popover. This is where any optional popover paramaters can be declared. Details on the available popover parameters are provided in the sections below.
Next, the popover wrapper is created. This wrapper class allows optional max-height to be set on popovers. This is especially useful for popovers that function as dropdown menus.
Popovers don't have any padding by default, however padding can be set by nesting a divider inside of the Popover__wrapper. The contents of the popover are contained within the divider as well.
The js-toggle-popover class must be included on the element that will trigger the popover. In this case, it is an anchor tag.
Triggering
Popovers can be triggered two ways: on click or hover. Click events require JavaScript. To enable click popovers, append .on-click to the .Popover-container. For hover popovers, append .on-hover instead.
The popover caret it optional. Append .has-caret accordingly. Generally, carets should only be used when the triggering element (ex: the yellow button below) does not also use a caret. That will protect against potential caret alignment issues.
There are left and right positioning classes for popovers that are top and bottom aligned. Adding a class Popover--flush-left or Popover--flush-right will adjust the popover's positioning and transform origin accordingly. By default, popovers are center positioned.
This is a top aligned popover that is flushed left with the clicked element.
There are also top and bottom positioning classes for popover that are left or right aligned. Adding classes Popover--flush-top or Popover--flush-bottom will adjust the popover's positioning and transform origin accordingly. By default, popovers are middle positioned.
This is a left aligned popover that is flushed top with the clicked element.
There are 4 popover themes: default (light), dark, error, and success. Apply .Popover--dark, .Popover--error, or .Popover--success accordingly. Omit all of the above to use the default theme.
There are 5 popover sizes, numbered 1 - 5 in order of smallest to largest. They don't apply inner padding, but instead change the width of the overall popover. Apply .Popover--1, .Popover--2, etc.
Dropdown menus leverage the lists component to create a simple menu with links, possibly used for header nav menus, filters, etc. Horizontal rules can be created within dropdowns by distributing links between multiple Popover__section dividers.
Note that Popover__section dividers are only required for dropdown menu Popovers.