Basic data list

Basic data list example

Basic data list accessibility

AttributeApplied toOutcome
role="list".pf-v6-c-data-listIndicates that the data list is a list. Required
aria-label.pf-v6-c-data-listProvides an accessible name for the data list. Required
aria-labelledby.pf-v6-c-data-list__itemProvides an accessible description for data list item. Required
id.pf-v6-c-data-list__cell, .pf-v6-c-data-list__cell *Provides a reference for data list item description. Required

Basic data list usage

ClassApplied toOutcome
.pf-v6-c-data-list<ul>Initiates a data list. Required
.pf-v6-c-data-list__item<li>Initiates a data list item. Required
.pf-v6-c-data-list__item-row<div>Initiates a data list item row. Required
.pf-v6-c-data-list__item-content<div>Initiates a container for data list content. Required
.pf-v6-c-data-list__cell*Initiates a data list content cell. Required
.pf-v6-c-data-list__cell-text<span>Initiates a data list content cell text element.
.pf-m-align-left.pf-v6-c-data-list__cellModifies a data list cell to not grow and align-left when its the first data-list__cell element.
.pf-m-no-fill.pf-v6-c-data-list__cellModifies a data list cell to not fill the available horizontal space.
.pf-m-align-right.pf-v6-c-data-list__cellModifies a data list cell to align-right.

Data list with headings

Data list with headings example

Data list with headings usage

When a list item includes more than one block of content, it can be difficult for some screen reader users to discern where one list item ends and the next one begins. A simple way to provide better separation of list items is to define the primary content section as a heading. Headings are useful for indicating a new section of contents, but also provide an easy way for screen reader users to navigate to specific sections on the page. The heading level should be based on the context in which the DataList component is being used. For example, if the heading for the section that contains the DataList is a level 3, then h4 elements should be used in the DataList list items.

Data list with checkboxes, actions, and additional cells

Data list with checkboxes, actions, and additional cells example

Data list with checkboxes, actions, and additional cells accessibility

AttributeApplied toOutcome
aria-label="[descriptive text]".pf-v6-c-data-list__action > .pf-v6-c-buttonProvides an accessible label buttons. Required
aria-labelledby="{title_cell_id}".pf-v6-c-data-list__check > .pf-v6-c-check__inputCreates an accessible label for the checkbox based on the title cell. Required
aria-labelledby="{title_cell_id} {data_list_action_id}".pf-v6-c-data-list__action > .pf-v6-c-buttonCreates an accessible label for the action button using the title cell and button label Required
id.pf-v6-c-data-list__cell > *, .pf-v6-c-data-list__check > .pf-v6-c-check__input, .pf-v6-c-data-list__action > .pf-v6-c-buttonProvides a reference for interactive elements. Required

Data list with checkboxes, actions, and additional cells usage

ClassApplied toOutcome
.pf-v6-c-data-list__item-control<div>Initiates a container for data list controls. For example, add .pf-v6-c-data-list__check here. Required
.pf-v6-c-data-list__item-action<div>Initiates a container for the data list actions. For example, add .pf-v6-c-data-list__action here. Required
.pf-v6-c-data-list__check<div>Initiates a data list check cell. Required
.pf-v6-c-data-list__action<div>Initiates a data list action button cell. Required
.pf-m-hidden{-on-[breakpoint]}.pf-v6-c-data-list__item-actionHides an actions container at optional breakpoint, or hides it at all breakpoints with .pf-m-hidden.
.pf-m-visible{-on-[breakpoint]}.pf-v6-c-data-list__item-actionShows an actions container at optional breakpoint.

Exandable data list

Expandable data list example

Compact expandable data list example

Nested expandable data list example

Compact data list

Compact data list example

Compact data list accessibility

AttributeApplied toOutcome
aria-expanded="true".pf-v6-c-data-list__toggle > .pf-v6-c-buttonIndicates that the expandable content is visible. Required
hidden.pf-v6-c-data-list__expandable-contentIndicates that the expandable content is hidden. Required
aria-label="[descriptive text]".pf-v6-c-data-list__toggle > .pf-v6-c-buttonProvides an accessible name for toggle button. Required
aria-labelledby="{title_cell_id} {button_id}".pf-v6-c-data-list__toggle > .pf-v6-c-buttonEstablishes relationship between aria-label text and toggle button. Required
id="{button_id}".pf-v6-c-data-list__toggle > .pf-v6-c-buttonProvides a reference for toggle button description. Required
aria-controls="[id of element controlled]".pf-v6-c-data-list__toggle > .pf-v6-c-buttonIdentifies the section controlled by the toggle button. Required

Compact data list usage

ClassApplied toOutcome
.pf-v6-c-data-list__item-control<div>Initiates a container for data list controls. For example, add .pf-v6-c-data-list__toggle here. Required
.pf-v6-c-data-list__toggle<div>Initiates a toggle button.
.pf-v6-c-data-list__toggle-icon<span>Initiates a toggle icon.
.pf-v6-c-data-list__expandable-content<div>Initiates an expandable content container.
.pf-v6-c-data-list__expandable-content-body<div>Initiates an expandable content container body. Required when .pf-v6-c-data-list__expandable-content is used.
.pf-m-expanded.pf-v6-c-data-list__itemModifies for expanded state.
.pf-m-compact.pf-v6-c-data-listModifies for compact variation.
.pf-m-no-padding.pf-v6-c-data-list__expandable-content-bodyRemoves padding for the expandable content body.
.pf-m-icon.pf-v6-c-data-list__cellModifies a data list cell to not grow and align-left when its the first data-list__cell element.

Data list modifiers

Data list flex modifiers example

Data list text modifiers example

Data list modifiers accessibility

AttributeApplied toOutcome
aria-controls="[id of element controlled]".pf-v6-c-data-list__toggle > .pf-v6-c-buttonIdentifies the section controlled by the toggle button. Required

Data list modifiers usage

ClassApplied toOutcome
.pf-m-flex-{1, 2, 3, 4, 5}.pf-v6-c-data-list__cellPercentage based modifier for .pf-v6-c-data-list__cell widths.
.pf-v6-c-data-list__text*Inserts the data list text element. Use this class to modify specific text directly.
.pf-m-truncate.pf-v6-c-data-list, .pf-v6-c-data-list__item-row, .pf-v6-c-data-list__cell, .pf-v6-c-data-list__textModifies the data list element so that text is truncated.
.pf-m-break-word.pf-v6-c-data-list, .pf-v6-c-data-list__item-row, .pf-v6-c-data-list__cell, .pf-v6-c-data-list__textModifies the data list element so that text breaks to the next line.
.pf-m-nowrap.pf-v6-c-data-list, .pf-v6-c-data-list__item-row, .pf-v6-c-data-list__cell, .pf-v6-c-data-list__textModifies the data list element so that text does not wrap to the next line.

Data list with clickable rows

Data list with clickable rows example

Data list with clickable expandable rows example

Data list with clickable rows accessibility

AttributeApplied toOutcome
tabindex="0".pf-v6-c-data-list__item.pf-m-clickableInserts the clickable row into the tab order of the page so that it is focusable. Required

Data list with clickable rows usage

ClassApplied toOutcome
.pf-m-clickable.pf-v6-c-data-list__itemModifies a data list item so that it is clickable.
.pf-m-selected.pf-v6-c-data-list__itemModifies a data list item for the selected state.

Draggable data list

Draggable data list example

Draggable data list accessibility

AttributeApplied toOutcome
aria-pressed="true or false".pf-v6-c-data-list__item-draggable-buttonIndicates that the button is a toggle. When set to “true”, pf-m-active should also be set so that the button displays in an active state.
aria-live[element with live text]Gives screen reader users live feedback about what’s happening during interaction with the data list, both during drag and drop interactions and keyboard interactions. Highly Recommended
aria-describedby="[id value of applicable content]".pf-v6-c-data-list__item-draggable-buttonGives the draggable button an accessible description by referring to the textual content that describes how to use the button to drag elements. The example here uses a <div id="draggable-help"></div>. Highly recommended
aria-labelledby="[id value of .pf-v6-c-data-list__item-draggable-button] [id value of .pf-v6-c-data-list__cell-text]".pf-v6-c-data-list__item-draggable-buttonProvides an accessible name for the draggable button.
id="[]".pf-v6-c-data-list__item-draggable-button, .pf-v6-c-data-list__cell-textGives the button and the text element accessible IDs

Draggable data list usage

ClassApplied toOutcome
.pf-v6-c-data-list__item-draggable-button<button>Initiates the draggable button. Use for drag and drop.
.pf-v6-c-data-list__item-draggable-icon<span>Initiates the draggable button icon.
.pf-m-draggable.pf-v6-c-data-list__itemModifies a data list item so that it is draggable.
.pf-m-ghost-row.pf-v6-c-data-list__item.pf-m-draggableModifies a draggable data list item to be the ghost row.
.pf-m-disabled.pf-v6-c-data-list__item.pf-m-draggableModifies a data list draggable item for the disabled state.
.pf-m-drag-over.pf-v6-c-data-listModifies the data list to indicate that a draggable item is being dragged over the data list.

Plain data list

Plain data list example

<ul
  class="pf-v6-c-data-list pf-m-plain"
  role="list"
  aria-label="Basic data list example"
  id="data-list-basic"
>
  <li class="pf-v6-c-data-list__item">
    <div class="pf-v6-c-data-list__item-row">
      <div class="pf-v6-c-data-list__item-content">
        <div class="pf-v6-c-data-list__cell">
          <span id="data-list-basic-item-1">Primary content</span>
        </div>
        <div class="pf-v6-c-data-list__cell">Secondary content</div>
      </div>
    </div>
  </li>

  <li class="pf-v6-c-data-list__item">
    <div class="pf-v6-c-data-list__item-row">
      <div class="pf-v6-c-data-list__item-content">
        <div class="pf-v6-c-data-list__cell pf-m-no-fill">
          <span id="data-list-basic-item-2">Secondary content (pf-m-no-fill)</span>
        </div>
        <div
          class="pf-v6-c-data-list__cell pf-m-no-fill pf-m-align-right"
        >Secondary content (pf-m-align-right pf-m-no-fill)</div>
      </div>
    </div>
  </li>
</ul>

Plain data list usage

ClassApplied toOutcome
.pf-m-plain.pf-v6-c-data-listModifies a data list to have a transparent background.
.pf-m-no-plain-on-glass.pf-v6-c-data-listPrevents the data list from automatically applying plain styling when glass theme is enabled.

Data list as grid

Data list as grid example

Data list as grid on small breakpoint example

Data list with no grid

Data list as grid usage

ClassApplied toOutcome
.pf-m-grid{-[none, sm, md, lg, xl, 2xl]}.pf-v6-c-data-listModifies the data list to switch to a grid layout at a specified breakpoint. .pf-m-grid will display the grid layout at all breakpoints. .pf-m-grid-none will display the desktop layout at all breakpoints. Note: Without a grid modifier, the data list will display the grid layout by default and switch to the desktop layout at a medium breakpoint.

Documentation

Overview

The DataList component provides a flexible alternative to the Table component, wherein individual data points may or may not exist within each row. DataList relies upon PatternFly layouts to achieve desired presentation within pf-v6-c-data-list__cell elements. DataLists do not have headers. If headers are required, use the table component.

CSS variables