Skip to content

Pill

Edit on GitHub
@volvo-cars/css v2.3.0

The pill component is a small label used to display a variety of metadata or helper texts.

The base pill component is meant to be a non-interactive element that can be used to help contextualize various states or options. It is often used as a sub component within other, more complex, components.

The pill component can be used in the following scenarios:

Displays information such as the current selection, slide show position, or selected values.

Showing a pill with the text 3/10

Showing a pill with the text 3/10.

Represents the status of an item, such as “Pending”, “Approved”, or “Completed”.

Status messaging example

Showing left aligned inline disclaimer on desktop.

Classifies content with tags like “Featured”, “Trending”, or “Popular”.

Tags example

Showing a pill that shows a relevant metadata tag.

Pill anatomy

  1. Plate – The plate is the base of the component. It can be displayed in different shades depending on the background or the importance of the information.
  2. Label – This is the actual value that is being displayed.

Filled variant

This is the base version of the pill, used to clearly signify active states or other important signifiers.

Outlined variant

The outlined version has less contrast when placed against the standard background color. It can therefore be used to show passive information.

Soft variant

The soft option can be used to display things such as metadata or tags that aren’t crucial to describing the current item or status.

The pill component is meant to adapt to the width of its content. The height should be consistent across all instances to maintain a uniform look.

Remember to keep the content short in order to prevent truncation or line wraps.

Pill dimensions

Displaying the standard dimensions of the pill.

The base pill component is non-interactive. It is solely used for display purposes and does not respond to user actions.

Users should be able to:

  • Read the information displayed within the pill using assistive technology
  • Navigate through content without relying on the pill for interaction

Light mode

Showing pill in light color mode.

Dark mode

Showing pill in dark color mode.

Use the pill to display concise, relevant metadata or status information.

Do - short text

Try to convey the information needed with as few words as possible.

Don't - long text

Don’t overload the pill with too much information, keep it short.

Ensure the pill text is legible and contrasts well with its background.

Do - good contrast

Use the primary variant on top of varying backgrounds such as images. Make sure to switch color mode between the images so that the pill always has a strong contrast compared to the background color.

Don't - poor contrast

Make sure the pill has visible contours in most situations.

Don't use as button

Don’t use the pill as a replacement for a button.

Figma - Web Core Library