Skip to Content
Patternfly Logo

Table

A table is used to display large data sets that can be easily laid out in a simple grid with column headers. Related design guidelines: Lists and tables

ExamplesPropsCSS Variables

Note: Table lives in its own package at @patternfly/react-table!

Examples

Basic

RepositoriesBranchesPull requestsWorkspacesLast Commit
onetwothreefourfive
one - 2
four - 2five - 2
one - 3two - 3three - 3four - 3five - 3 (not centered)

Row click handler

Row Click Handler Table
RepositoriesBranchesPull requestsWorkspaces
Repositories oneBranches onePull requests oneWorkspaces one
Repositories twoBranches twoPull requests twoWorkspaces two
Repositories threeBranches threePull requests threeWorkspaces three

Custom row wrapper

Table with custom row wrapper that styles odd rows
RepositoriesBranchesPull requestsWorkspaces
Repositories oneBranches onePull requests oneWorkspaces one
Repositories twoBranches twoPull requests twoWorkspaces two
Repositories threeBranches threePull requests threeWorkspaces three

Sortable

BranchesWorkspacesLast Commit
onetwoafourfive
atwokfourfive
ptwobfourfive

Sortable with wrapping headers

onetwoafourfive
atwokfourfive
ptwobfourfive

Selectable

RepositoriesBranchesPull requestsWorkspacesLast Commit
one
twoafourfive
a
twokfourfive
p
twobfourfive

Simple actions

RepositoriesBranchesPull requestsWorkspacesLast Commit
one
twoafourfive
a
twokfourfive
p
twobfourfive

Actions

RepositoriesBranchesPull requestsWorkspacesLast Commit
one
twoafourfive
a
twokfourfive
p
twobfourfive
5
2bfourfive

First cell as header

Header cellBranchesPull requestsWorkspacesLast Commit
one
twothreefourfive

Compact

Header cellBranchesPull requests
onetwothreefour
onetwothreefour
onetwothreefour

Compact borderless rows

Header cellBranchesPull requests
onetwothreefour
onetwothreefour
onetwothreefour

Compact expandable

Header cellBranchesPull requests
onetwothreefour
parent - 1twothreefour
child - 1
parent - 2twothreefour
parent - 3twothreefour

With width modifiers

Header cellBranchesPull requestsWorkspacesLast Commit
onetwothreefourfive

Breakpoint modifiers

RepositoriesBranchesPull requestsWorkspacesLast Commit
Visible only on md breakpoint10Hidden only on md breakpoint5Hidden on xs breakpoint
Repository 2102552 days ago
Repository 3102552 days ago
Repository 4102552 days ago

Collapsible

Header cellBranchesPull requestsWorkspacesLast Commit
onetwothreefourfive
parent - 1twothreefourfive
child - 1
parent - 2twothreefourfive
parent - 3twothreefourfive

Compound expandable

RepositoriesBranchesPull requestsWorkspacesLast Commit
siemur/test-space20 minutesOpen in Github
BranchesWorkspacesLast Commit
parent-0compound-1threefourfive
atwokfourfive
ptwobfourfive
siemur/test-space20 minutesOpen in Github

Wrapping headers

This is a really long table header that goes on for a long time 1.This is a really long table header that goes on for a long time 2.This is a really long table header that goes on for a long time 3.This is a really long table header that goes on for a long time 4.This is a really long table header that goes on for a long time 5.
Repository 1102552 days ago
Repository 2102552 days ago
Repository 3102552 days ago
Repository 4102552 days ago

Empty state

Empty State Table Example
RepositoriesBranchesPull requestsWorkspacesLast Commit

No results found

No results match the filter criteria. Remove all filters or clear all filters to show results.

Editable rows Beta

Text input col 1Disabled text input col 2Text input col 3Text input col 4
Row 1 cell 1 content
Row 1 cell 2, disabled content
Row 1 cell 3 content
Row 1 cell 4 content
Row 2 cell 1 content
Row 2 cell 2, disabled content
Row 2 cell 3 content
Row 2 cell 4 content
Row 3 cell 1 content
Row 3 cell 2, disabled content
Row 3 cell 3 content
Row 3 cell 4 content

Props

Table properties
NameTypeRequiredDefaultDescription
aria-labelstringNoundefinedAdds an accessible name for the Table
childrenReact.ReactNodeNonullContent rendered inside the Table
classNamestringNo''Additional classes added to the Table
variantliteralNonullStyle variant for the Table
bordersbooleanNotrueRender borders
gridBreakPoint'' | 'grid' | 'grid-md' | 'grid-lg' | 'grid-xl' | 'grid-2xl'NoTableGridBreakpoint.gridMdSpecifies the grid breakpoints
sortByISortByNoSpecifies the initial sorting pattern for the table - asc/desc and the index of the column to sort by
onCollapse( event: React.MouseEvent, rowIndex: number, isOpen: boolean, rowData: IRowData, extraData: IExtraData ) => voidNoFunction triggered when an expandable content is collapsed. When this is used, one expandable toggle button will be positioned in the first cell of a non-expandable row, preceding an expandable row
onExpand( event: React.MouseEvent, rowIndex: number, colIndex: number, isOpen: boolean, rowData: IRowData, extraData: IExtraData ) => voidNoFunction triggered when a compound expandable item is clicked
onSelect( event: React.FormEvent<HTMLInputElement>, isSelected: boolean, rowIndex: number, rowData: IRowData, extraData: IExtraData ) => voidNoFunction triggered when a row's checkbox is selected. When this is used, one checkbox will be positioned in the first or second cell of a non-expandable row
canSelectAllbooleanNotrueEnables or Disables the ability to select all
onRowEditBeta( event: React.MouseEvent<HTMLButtonElement>, type: RowEditType, isEditable?: boolean, rowIndex?: number, validationErrors?: RowErrors ) => voidNoFunction triggered when a row's inline edit is activated. Adds a column for inline edit when present.
onSort( event: React.MouseEvent, columnIndex: number, sortByDirection: SortByDirection, extraData: IExtraColumnData ) => voidNoFunction triggered when sort icon is clicked
actions(IAction | ISeparator)[]NoActions to add to the Table
actionResolver(rowData: IRowData, extraData: IExtraData) => (IAction | ISeparator)[]NoResolver for the given action
areActionsDisabled(rowData: IRowData, extraData: IExtraData) => booleanNoSpecifies if the Kebab for actions is disabled
headerReact.ReactNodeNoundefinedComponent to place in the header
captionReact.ReactNodeNoundefinedComponent used for caption
rowLabeledBystringNo'simple-node'label for row
expandIdstringNo'expandable-toggle'ID for expand
contentIdstringNo'expanded-content'ID for content
dropdownPosition'right' | 'left'NoDropdownPosition.rightThe desired position to show the dropdown when clicking on the actions Kebab. Can only be used together with `actions` property
dropdownDirection'up' | 'down'NoDropdownDirection.downThe desired direction to show the dropdown when clicking on the actions Kebab. Can only be used together with `actions` property
rows(IRow | string[])[]YesRow data
cells(ICell | string)[]YesCell data
bodyWrapperFunctionNoWrapper for the body
rowWrapper(props: RowWrapperProps) => JSX.ElementNoWrapper for the row
rolestringNo'grid'A valid WAI-ARIA role to be applied to the table element
TableHeader properties
NameTypeRequiredDefaultDescription
classNamestringNoAdditional classes added to the TableHeader
TableBody properties
NameTypeRequiredDefaultDescription
classNamestringNo''Additional classes added to the TableBody
childrenReact.ReactNodeNonullThis prop should not be set manually
headerDataIRow[]NoThis prop should not be set manually
rowsIRow[]NoThis prop should not be set manually
rowKeyRowKeyTypeNo'id'This prop should not be set manually
onRowClick( event: React.MouseEvent, row: IRow, rowProps: IExtraRowData, computedData: IComputedData ) => voidNo(event: React.MouseEvent, row: IRow, rowProps: IExtraRowData, computedData: IComputedData) => /* eslint-enable @typescript-eslint/no-unused-vars */ undefined as OnRowClickThis prop should not be set manually
onRowFunctionNo(...args: any) => ObjectThis prop should not be set manually

CSS Variables

.pf-c-table--pf-global--Color--100
#151515
.pf-c-table--pf-global--Color--200
#6a6e73
.pf-c-table--pf-global--BorderColor--100
#d2d2d2
.pf-c-table--pf-global--primary-color--100
#06c
.pf-c-table--pf-global--link--Color
#06c
.pf-c-table--pf-global--link--Color--hover
#004080
.pf-c-table--pf-global--BackgroundColor--100
#fff
.pf-c-table--pf-c-table--BackgroundColor
#fff
.pf-c-table--pf-c-table--BorderColor
#d2d2d2
.pf-c-table--pf-c-table--BorderWidth
1px
.pf-c-table--pf-c-table-cell--FontWeight
400
.pf-c-table--pf-c-table-caption--FontSize
0.875rem
.pf-c-table--pf-c-table-caption--Color
#6a6e73
.pf-c-table--pf-c-table-caption--PaddingTop
1rem
.pf-c-table--pf-c-table-caption--PaddingRight
1.5rem
.pf-c-table--pf-c-table-caption--xl--PaddingRight
1rem
.pf-c-table--pf-c-table-caption--PaddingBottom
1rem
.pf-c-table--pf-c-table-caption--PaddingLeft
1.5rem
.pf-c-table--pf-c-table-caption--xl--PaddingLeft
1rem
.pf-c-table--pf-c-table-thead--FontSize
0.875rem
.pf-c-table--pf-c-table-thead--FontWeight
600
.pf-c-table--pf-c-table-thead-cell--PaddingTop
1rem
.pf-c-table--pf-c-table-thead-cell--PaddingBottom
1rem
.pf-c-table--pf-c-table-cell--hidden-visible--Display
table-cell
.pf-c-table--pf-c-table-tbody-cell--PaddingTop
1.5rem
.pf-c-table--pf-c-table-tbody-cell--PaddingBottom
1.5rem
.pf-c-table--pf-c-table-cell--PaddingTop
1rem
.pf-c-table--pf-c-table-cell--PaddingRight
1rem
.pf-c-table--pf-c-table-cell--PaddingBottom
1rem
.pf-c-table--pf-c-table-cell--PaddingLeft
1rem
.pf-c-table--pf-c-table-cell--FontSize
1rem
.pf-c-table--pf-c-table-cell--first-last-child--PaddingLeft
1.5rem
.pf-c-table--pf-c-table-cell--first-last-child--PaddingRight
1.5rem
.pf-c-table--pf-c-table-cell--first-last-child--xl--PaddingLeft
1rem
.pf-c-table--pf-c-table-cell--first-last-child--xl--PaddingRight
1rem
.pf-c-table--pf-c-table__toggle--c-button--MarginTop
calc(0.375rem * -1)
.pf-c-table--pf-c-table__toggle--c-button__toggle-icon--Transform
rotate(270deg)
.pf-c-table--pf-c-table__toggle--c-button__toggle-icon--Transition
.2s ease-in 0s
.pf-c-table--pf-c-table__toggle--c-button--m-expanded__toggle-icon--Transform
rotate(360deg)
.pf-c-table--pf-c-table--m-compact__toggle--PaddingTop
0
.pf-c-table--pf-c-table--m-compact__toggle--PaddingBottom
0
.pf-c-table--pf-c-table__check--input--MarginTop
0.1875rem
.pf-c-table--pf-c-table__check--input--FontSize
1rem
.pf-c-table--pf-c-table__action--PaddingTop
0
.pf-c-table--pf-c-table__action--PaddingRight
0
.pf-c-table--pf-c-table__action--PaddingBottom
0
.pf-c-table--pf-c-table__action--PaddingLeft
0
.pf-c-table--pf-c-table__inline-edit-action--PaddingTop
0
.pf-c-table--pf-c-table__inline-edit-action--PaddingRight
0
.pf-c-table--pf-c-table__inline-edit-action--PaddingBottom
0
.pf-c-table--pf-c-table__inline-edit-action--PaddingLeft
0
.pf-c-table--pf-c-table__expandable-row--Transition
all 250ms cubic-bezier(.42, 0, .58, 1)
.pf-c-table--pf-c-table__expandable-row--before--Width
3px
.pf-c-table--pf-c-table__expandable-row--before--BackgroundColor
#06c
.pf-c-table--pf-c-table__expandable-row--before--ZIndex
200
.pf-c-table--pf-c-table__expandable-row--before--Top
calc(1px * -1)
.pf-c-table--pf-c-table__expandable-row--before--Bottom
calc(1px * -1)
.pf-c-table--pf-c-table__expandable-row--MaxHeight
28.125rem
.pf-c-table--pf-c-table__expandable-row-content--Transition
all 250ms cubic-bezier(.42, 0, .58, 1)
.pf-c-table--pf-c-table__expandable-row-content--PaddingTop
1.5rem
.pf-c-table--pf-c-table__expandable-row-content--PaddingBottom
1.5rem
.pf-c-table--pf-c-table__sort-indicator--MarginLeft
1rem
.pf-c-table--pf-c-table__sort-indicator--Color
#d2d2d2
.pf-c-table--pf-c-table__sort-indicator--hover--Color
#151515
.pf-c-table--pf-c-table__sort--c-button--Color
#151515
.pf-c-table--pf-c-table__sort-indicator--LineHeight
1.5
.pf-c-table--pf-c-table__icon-inline--MarginRight
0.5rem
.pf-c-table--pf-c-table--nested--first-last-child--PaddingRight
4rem
.pf-c-table--pf-c-table--nested--first-last-child--PaddingLeft
4rem
.pf-c-table--pf-c-table--m-compact-th--PaddingTop
calc(0.5rem + 0.25rem)
.pf-c-table--pf-c-table--m-compact-th--PaddingBottom
0.5rem
.pf-c-table--pf-c-table--m-compact-cell--PaddingTop
0.5rem
.pf-c-table--pf-c-table--m-compact-cell--PaddingRight
0.5rem
.pf-c-table--pf-c-table--m-compact-cell--PaddingBottom
0.5rem
.pf-c-table--pf-c-table--m-compact-cell--PaddingLeft
0.5rem
.pf-c-table--pf-c-table--m-compact-cell--first-last-child--PaddingLeft
1.5rem
.pf-c-table--pf-c-table--m-compact-cell--first-last-child--PaddingRight
1.5rem
.pf-c-table--pf-c-table--m-compact-cell--first-last-child--xl--PaddingLeft
1rem
.pf-c-table--pf-c-table--m-compact-cell--first-last-child--xl--PaddingRight
1rem
.pf-c-table--pf-c-table--m-compact--FontSize
0.875rem
.pf-c-table--pf-c-table--m-compact__expandable-row-content--PaddingTop
1.5rem
.pf-c-table--pf-c-table--m-compact__expandable-row-content--PaddingRight
1.5rem
.pf-c-table--pf-c-table--m-compact__expandable-row-content--PaddingBottom
1.5rem
.pf-c-table--pf-c-table--m-compact__expandable-row-content--PaddingLeft
1.5rem
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderTop--BorderWidth
3px
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderTop--BorderColor
#06c
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderRight--BorderWidth
1px
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderLeft--BorderWidth
1px
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderRight--BorderColor
#d2d2d2
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderLeft--BorderColor
#d2d2d2
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderBottom--BorderWidth
1px
.pf-c-table--pf-c-table__compound-expansion-toggle--BorderBottom--BorderColor
#fff
.pf-c-table--pf-c-table__expandable-row--m-expanded--BorderBottomColor
#d2d2d2
.pf-c-table--pf-c-table__sort--sorted--Color
#06c
.pf-c-table tr > *--pf-hidden-visible--visible--Visibility
visible
.pf-c-table tr > *--pf-hidden-visible--hidden--Display
none
.pf-c-table tr > *--pf-hidden-visible--hidden--Visibility
hidden
.pf-c-table tr > *--pf-hidden-visible--Display
table-cell
.pf-c-table tr > *--pf-hidden-visible--Visibility
visible
.pf-c-table tr > *--pf-hidden-visible--visible--Display
table-cell
.pf-c-table tr > .pf-m-hidden--pf-hidden-visible--Display
none
.pf-c-table tr > .pf-m-hidden--pf-hidden-visible--Visibility
hidden
.pf-c-table tr > *:first-child--pf-c-table-cell--PaddingLeft
1.5rem
.pf-c-table tr > *:last-child--pf-c-table-cell--PaddingRight
1.5rem
.pf-c-table thead--pf-c-table-cell--PaddingTop
1rem
.pf-c-table thead--pf-c-table-cell--PaddingBottom
1rem
.pf-c-table thead--pf-c-table-cell--FontSize
0.875rem
.pf-c-table thead--pf-c-table-cell--FontWeight
600
.pf-c-table tbody--pf-c-table-cell--PaddingTop
1.5rem
.pf-c-table tbody--pf-c-table-cell--PaddingBottom
1.5rem
.pf-c-table .pf-c-table__toggle--pf-c-table-cell--PaddingBottom
0
.pf-c-table__toggle--pf-c-table-cell--PaddingRight
0
.pf-c-table__toggle--pf-c-table-cell--PaddingLeft
0
.pf-c-table__check--pf-c-table-cell--FontSize
1rem
.pf-c-table__action--pf-c-table-cell--PaddingTop
0
.pf-c-table__action--pf-c-table-cell--PaddingRight
0
.pf-c-table__action--pf-c-table-cell--PaddingBottom
0
.pf-c-table__action--pf-c-table-cell--PaddingLeft
0
.pf-c-table__inline-edit-action--pf-c-table-cell--PaddingLeft
0
.pf-c-table__inline-edit-action--pf-c-table-cell--PaddingRight
0
.pf-c-table__compound-expansion-toggle .pf-c-button--pf-c-button--BorderRadius
0
.pf-c-table__expandable-row--pf-c-table-cell--PaddingTop
0
.pf-c-table__expandable-row--pf-c-table-cell--PaddingBottom
0
.pf-c-table .pf-c-table tr > *:first-child--pf-c-table-cell--PaddingLeft
4rem
.pf-c-table .pf-c-table tr > *:last-child--pf-c-table-cell--PaddingRight
4rem
.pf-c-table.pf-m-compact--pf-c-table-cell--FontSize
0.875rem
.pf-c-table.pf-m-compact.pf-m-no-border-rows:not(.pf-m-expandable) tbody--pf-c-table--BorderWidth
0
.pf-c-table.pf-m-compact.pf-m-no-border-rows:not(.pf-m-expandable) tbody--pf-c-table--BorderColor
transparent
.pf-c-table.pf-m-compact tr--pf-c-table-cell--PaddingLeft
0.5rem
.pf-c-table.pf-m-compact tr--pf-c-table-cell--PaddingRight
0.5rem
.pf-c-table.pf-m-compact tr:not(.pf-c-table__expandable-row)--pf-c-table-cell--FontSize
0.875rem
.pf-c-table.pf-m-compact tr:not(.pf-c-table__expandable-row)--pf-c-table-cell--PaddingTop
0.5rem
.pf-c-table.pf-m-compact tr:not(.pf-c-table__expandable-row)--pf-c-table-cell--PaddingBottom
0.5rem
.pf-c-table.pf-m-compact tr:not(.pf-c-table__expandable-row) > *:first-child--pf-c-table-cell--PaddingLeft
1.5rem
.pf-c-table.pf-m-compact tr:not(.pf-c-table__expandable-row) > *:last-child--pf-c-table-cell--PaddingRight
1.5rem
.pf-c-table.pf-m-compact thead--pf-c-table--m-compact-cell--PaddingTop
calc(0.5rem + 0.25rem)
.pf-c-table.pf-m-compact thead--pf-c-table--m-compact-cell--PaddingBottom
0.5rem
.pf-c-table.pf-m-compact .pf-c-table__action--pf-c-table-cell--PaddingTop
0
.pf-c-table.pf-m-compact .pf-c-table__action--pf-c-table-cell--PaddingBottom
0
.pf-c-table.pf-m-compact .pf-c-table__action--pf-c-table-cell--PaddingLeft
0
.pf-c-table.pf-m-compact .pf-c-table__toggle--pf-c-table-cell--PaddingTop
0
.pf-c-table.pf-m-compact .pf-c-table__toggle--pf-c-table-cell--PaddingBottom
0
.pf-c-table .pf-c-table.pf-m-compact tr > *:first-child--pf-c-table-cell--PaddingLeft
4rem
.pf-c-table .pf-c-table.pf-m-compact tr > *:last-child--pf-c-table-cell--PaddingRight
4rem
.pf-c-table.pf-m-compact .pf-c-table__expandable-row-content--pf-c-table__expandable-row-content--PaddingTop
1.5rem
.pf-c-table.pf-m-compact .pf-c-table__expandable-row-content--pf-c-table__expandable-row-content--PaddingBottom
1.5rem