Examples
Documentation
Overview
There are two variations to build the accordion component. The first is to use <div>
and <h1 - h6>
tags:
.pf-v6-c-accordion
is placed on a<div>
,.pf-v6-c-accordion__toggle
is placed on a<button>
that is inside a<h1-h6>
, and.pf-v6-c-accordion__expandable-content
is placed on a<div>
.
The heading level that you use should fit within the rest of the headings outlined on your page.
Another variation is using the definition list:
.pf-v6-c-accordion
is placed on a<dl>
,.pf-v6-c-accordion__toggle
is placed on a<button>
that is inside a<dt>
, and.pf-v6-c-accordion__expandable-content
is placed on a<dd>
.
Usage
Class | Applied to | Outcome |
---|---|---|
.pf-v6-c-accordion | <div> , <dl> | Initiates an accordion component. Required |
.pf-v6-c-accordion__item | <div> | Initiates an accordion item component. Required |
.pf-v6-c-accordion__toggle | <h1-h6><button> , <dt><button> | Initiates a toggle in the accordion. Required |
.pf-v6-c-accordion__toggle-text | <span> | Initiates the text inside the toggle. Required |
.pf-v6-c-accordion__toggle-icon | <span> | Initiates the toggle icon wrapper. Required |
.pf-v6-c-accordion__expandable-content | <div> , <dd> | Initiates expandable content. Must be paired with a button |
.pf-v6-c-accordion__expandable-content-body | <div> | Initiates expandable content body. Required |
.pf-m-bordered | .pf-v6-c-accordion | Modifies the accordion to add borders between items. |
.pf-m-display-lg | .pf-v6-c-accordion | Modifies the accordion for large display styling. This variation is for marketing/web use cases. |
.pf-m-toggle-start | .pf-v6-c-accordion | Modifies accordion styling when accordion toggle icons are rendered at the start of the toggle, before the toggle text. |
.pf-m-expanded | .pf-v6-c-accordion__item | Modifies the accordion item for the expanded state. |
.pf-m-fixed | .pf-v6-c-accordion__expandable-content | Modifies the expandable content for the fixed state. |
CSS variables
Expand or collapse column | Selector | Variable | Value | |
---|---|---|---|---|
.pf-v6-c-accordion | --pf-v6-c-accordion--BackgroundColor | (In light theme) #ffffff | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--RowGap | 0.25rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__item--BorderRadius | 6px | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__item--m-expanded--BackgroundColor | (In light theme) rgba(199, 199, 199, 0.2500) | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--ColumnGap | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--PaddingBlockStart | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--PaddingInlineEnd | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--PaddingBlockEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--m-expanded--PaddingBlockEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--PaddingInlineStart | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--BackgroundColor | (In light theme) rgba(255, 255, 255, 0.0000) | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--hover--BackgroundColor | (In light theme) rgba(199, 199, 199, 0.2500) | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--BorderRadius | 6px | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-toggle-start__toggle--ColumnGap | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle-text--Color | (In light theme) #151515 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle-text--FontWeight | 400 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--m-expanded__toggle-text--FontWeight | 500 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--m-expanded__toggle-text--FontWeight | 500 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle-icon--Transition | .2s ease-in 0s | ||
.pf-v6-c-accordion | --pf-v6-c-accordion__toggle--m-expanded__toggle-icon--Rotate | 90deg | ||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--MarginInlineEnd | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--MarginBlockEnd | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--MarginInlineStart | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--BackgroundColor | (In light theme) #ffffff | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--BorderRadius | 6px | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--Color | (In light theme) #151515 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--FontSize | 0.875rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content--m-fixed--MaxHeight | 9.375rem | ||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content-body--PaddingBlockStart | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content-body--PaddingInlineEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content-body--PaddingBlockEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content-body--PaddingInlineStart | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__expandable-content-body--expandable-content-body--PaddingBlockStart | 0 | ||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--PaddingBlockStart | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--PaddingInlineEnd | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--PaddingBlockEnd | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--m-expanded--PaddingBlockEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--PaddingInlineStart | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--FontFamily | "Red Hat Display", "RedHatDisplay", "Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans JP", "Noto Sans KR", "Noto Sans Malayalam", "Noto Sans SC", "Noto Sans TC", "Noto Sans Thai", Helvetica, Arial, sans-serif | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle--FontSize | 1.125rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__toggle-text--FontWeight | 500 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__expandable-content--FontSize | 1rem | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-display-lg__expandable-content--Color | (In light theme) #151515 | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion--m-bordered--RowGap | 0 | ||
.pf-v6-c-accordion | --pf-v6-c-accordion__item--m-bordered--BorderBlockEndWidth | 1px | ||
| ||||
.pf-v6-c-accordion | --pf-v6-c-accordion__item--m-bordered--BorderBlockEndColor | (In light theme) #c7c7c7 | ||
| ||||
.pf-v6-c-accordion.pf-m-toggle-start | --pf-v6-c-accordion__toggle--ColumnGap | 0.5rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--PaddingBlockStart | 1rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--PaddingInlineEnd | 1rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--PaddingBlockEnd | 1rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--m-expanded--PaddingBlockEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--PaddingInlineStart | 1rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--FontFamily | "Red Hat Display", "RedHatDisplay", "Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans JP", "Noto Sans KR", "Noto Sans Malayalam", "Noto Sans SC", "Noto Sans TC", "Noto Sans Thai", Helvetica, Arial, sans-serif | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--FontSize | 1.125rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle-text--FontWeight | 500 | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__toggle--m-expanded__toggle-text--FontWeight | 500 | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__expandable-content--FontSize | 1rem | ||
| ||||
.pf-v6-c-accordion.pf-m-display-lg | --pf-v6-c-accordion__expandable-content--Color | (In light theme) #151515 | ||
| ||||
.pf-v6-c-accordion.pf-m-bordered | --pf-v6-c-accordion--RowGap | 0 | ||
| ||||
.pf-v6-c-accordion.pf-m-bordered | --pf-v6-c-accordion__item--BorderRadius | 0 | ||
.pf-v6-c-accordion.pf-m-bordered | --pf-v6-c-accordion__toggle--BorderRadius | 0 | ||
.pf-v6-c-accordion__item.pf-m-expanded | --pf-v6-c-accordion__toggle--PaddingBlockEnd | 0.5rem | ||
| ||||
.pf-v6-c-accordion__item.pf-m-expanded | --pf-v6-c-accordion__toggle-text--FontWeight | 500 | ||
| ||||
.pf-v6-c-accordion__toggle:is(:hover, :focus) | --pf-v6-c-accordion__toggle--BackgroundColor | (In light theme) rgba(199, 199, 199, 0.2500) | ||
| ||||
.pf-v6-c-accordion__expandable-content-body + .pf-v6-c-accordion__expandable-content-body | --pf-v6-c-accordion__expandable-content-body--PaddingBlockStart | 0 | ||
|