Playbook logo
14.18.0

Table

Tables display a collection of structured data and typically have the ability to sort, filter, and paginate data. Good data tables allows the user to scan, analyze, compare, filter, and sort information to derive insights and commit actions.
Table shift and alignment attributes can work in conjunction with each other, as well as be applied to the table header (not just the table body).

Small

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Use table size "sm" when data density is a priority. Smaller row height enables the user to view more data without the need for scrolling.

Table can leverage the max-width property. Learn more in our visual guidelines.

Medium

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Use table size "md" to add padding around each row to increase reading comfortability.

Large

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Use table size "lg" to add padding around each row to maximize reading comfortability.



React: Use sticky on a table to allow the table header to be fixed in place when the user scrolls up and down on the page.

Rails: Pass sticky: true to props.

If the table header is not sticking in the right place you will need to pass a inline top style to the thead.
React Example: <thead style={{ top: "-16px" }}>
Rails Example: <thead style="top: -16px">

Troubleshooting CSS Problems

Sticky may not work if any parent/ancestor of the sticky element has any of the overflow properties set. Additionally, specifying a height on the overflowing container provides measurement for this feature to work properly. In some cases, it may be necessary to set the same parent/ancestor container to position: static as well.

Sticky Left Column

Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 10Column 11Column 12Column 13Column 14Column 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15

The stickyLeftColumn prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the <th> and <td>.

If you are using the sub-component variant, then you will pass the id to <Table.Header> and <Table.Cell>

Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using stickyLeftColumn prop.

Sticky Right Column

Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 10Column 11Column 12Column 13Column 14Column 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15

The stickyRightColumn prop works in the same way as the above stickyLeftColumn prop. It expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the <th> and <td>.

If you are using the sub-component variant, then you will pass the id to <Table.Header> and <Table.Cell>

Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the stickyRightColumn prop.

Sticky Left and Right Columns

Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 10Column 11Column 12Column 13Column 14Column 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15
Value 1Value 2Value 3Value 4Value 5Value 6Value 7Value 8Value 9Value 10Value 11Value 12Value 13Value 14Value 15

The stickyLeftColumn and stickyRightColumn props can be used together on the same table as needed.

Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using props.

Row Alignment

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Pass our textAlign global prop to any table.row subcomponent to change the text alignment of all cells within that row.
The header/ first row is the default, followed by the second row being centered, and then the last row shifted to the right.

Cell Alignment

Column 1Column 2Column 3RatingMoney
Value 1Value 2Value 33$57.32
Value 1Value 2Value 32$5,657.08
Value 1Value 2Value 34$358.77

Pass our textAlign global prop to any table.cell subcomponent to change the text alignment of individual cells, or apply this prop persistently to align entire columns.
In the table above the "Rating" column contents is centered and the "Money" column contents is right aligned.

Row Shift

Column 1Column 2Column 3Column 4Column 5
Value 1a
Value 1a
Value 1a
Value 2aValue 3aValue 4aValue 5a
Value 1b
Value 1b
Value 1b
Value 2bValue 3bValue 4bValue 5b
Value 1c
Value 1c
Value 1c
Value 2cValue 3cValue 4cValue 5c

Pass our verticalAlign global prop to any table.row subcomponent to change the vertical alignment of all cells within that row.

Cell Shift

 Price
Total$12
$46
$25
-------
$83
Espresso DrinksIngredients
Cappuccino Steamed Milk
Milk Foam
MacchiatoEspresso
Steamed Milk
MochaHot Chocolate
Steamed Milk

Pass our verticalAlign global prop to any table.cell subcomponent to change the text alignment of individual cells, or apply this prop persistently to align entire columns.
The first table shifts "Total" down, whereas the second table shifts the "Espresso Drinks" column contents up.

Side Highlight

Product colorsColumn 2Column 3Column 4Column 5
Product 1Value 2Value 3Value 4Value 5
Product 2Value 2Value 3Value 4Value 5
Product 3Value 2Value 3Value 4Value 5
NoneValue 2Value 3Value 4Value 5

Status colorsColumn 2Column 3Column 4Column 5
SuccessValue 2Value 3Value 4Value 5
WarningValue 2Value 3Value 4Value 5
ErrorValue 2Value 3Value 4Value 5
NoneValue 2Value 3Value 4Value 5

Category ColorsColumn 2Column 3Column 4Column 5
Category Color 1Value 2Value 3Value 4Value 5
Category Color 2Value 2Value 3Value 4Value 5
Category Color 3Value 2Value 3Value 4Value 5
NoneValue 2Value 3Value 4Value 5

Side highlight can take product, status, and category colors. To view full list of colors, visit token colors.

Note: Only use category colors for categories. Do not mix it with product or status colors.

Table Container Off

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Disable Hover

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Multi-line

Column 1Column 2Column 3Column 4Column 5
Value 1
Value 1
Value 1
Value 2Value 3
Value 3
Value 4Value 5
Value 1
Value 1
Value 1
Value 2Value 3
Value 3
Value 4Value 5
Value 1
Value 1
Value 1
Value 2Value 3
Value 3
Value 4Value 5

Force Single Line

Column 1Column 2Column 3Column 4Column 5
Value 1
Value 1
Value 1
Value 2Value 3
Value 3
Value 4Value 5
Value 1
Value 1
Value 1
Value 2Value 3
Value 3
Value 4Value 5
Value 1
Value 1
Value 1
Value 2Value 3
Value 3
Value 4Value 5

Data Table

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Tighter spacing in first- and last-child cells of each row for data-heavy tables.

Responsive Tables

Not Responsive

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5


Collapse Mobile

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5


Collapse Tablet

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5


Collapse Desktop

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5

Table with 1 Action

Column 1Column 2Column 3Column 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4

If there is one button on each row of the table, ideally, it should use the secondary variant and be placed at the end of the row

Table with 2 Actions

Column 1Column 2Column 3Column 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4

If there are two actions on each of the row, one should ideally one should use the secondary variant and the other use the link variant. The button using the secondary variant should be placed at the end.

Table with 2+ Actions

Column 1Column 2Column 3Column 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4

If there are more than two actions on each row, then they should be contained in secondary circle icon button with the ellipsis-h icon (horizontal ellipsis) at the end of the row

Table with Actions in the Middle

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2 Value 4Value 5
Value 1Value 2 Value 4Value 5
Value 1Value 2 Value 4Value 5

If the button is towards the middle of the table, it should likely use button variant link

Table with Icon Buttons

Column 1Column 2Column 3Column 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value lk

Icon buttons are great to use if space is limited. If the icon isn’t VERY self explanatory (for example pencil/pen for edit, trashcan for delete) then it should use a tooltip explaining what the action does. The tooltip shouldn’t be longer than a few words and essentially serves as a replacement for what the button would say if it weren’t an icon

Table With Background Kit

Column 1Column 2Column 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Column 1Column 2Column 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3
Value 1Value 2Value 3

Vertical Borders

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Striped Table

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Optionally pass the striped (boolean, defaults to false) prop to set odd rows to a contrasting background color. This helps with readability on larger tables with lots of data.

Table with Sub Components (Table Elements)

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

You can optionally build your table using our sub-components, which map to their respective html table elements:

Table.Head = thead
Table.Body = tbody
Table.Row = tr
Table.Header = th
Table.Cell = td

Table with Sub Components (Divs)

Column 1
Column 2
Column 3
Column 4
Column 5
Value 1
Value 2
Value 3
Value 4
Value 5
Value 1
Value 2
Value 3
Value 4
Value 5
Value 1
Value 2
Value 3
Value 4
Value 5

Optionally build your table with divs by passing div to the tag prop of all* your sub-components.

*NOTE: The tag prop defaults to table, which returns html elements. If divs are desired, sub-components must be used and all table elements, including the initial kit call, must use div as their tag in order for the table to render properly.

Outer Padding

Column 1Column 2Column 3Column 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4
Value 1Value 2Value 3Value 4

Pass any of our spacing tokens to the outerPadding / outer_padding prop to customize a table's outer padding (both the left padding of the first column and the right padding of the last column).

Table with Collapsible

Nested content inside a Table Row
Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

The collapsible prop can be used on any Table Row to add a collapsible area. Use the additional collapsibleContent prop to add any content to the collapsible Row.

Table with Collapsible with Custom Click

Nested content inside a Table Row
Nested content inside a Table Row
Nested content inside a Table Row
Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

When using the collapsible prop, the default functionality is that the entire Row will be clickable to toggle the Row. To limit the click event to a specific Table Cell, you can use the toggleCellId prop to pass in the id of the Cell you want to use as the trigger.
NOTE: toggleCellId and the id on the Cell you want to use as the trigger MUST be the same.

Table with Collapsible with Custom Content

Expanded Custom Layout
Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Table with Collapsible with Nested Rows

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
ExpandedExpandedExpandedExpandedExpanded
Value 1Value 2Value 3Value 4Value 5Value 1Value 2Value 3Value 4Value 5

The collapsibleContent can display any content, including nested Table Rows.

Additionally, the collapsibleSideHighlight can also be removed by setting it to false if needed. This prop is set to true by default.

NOTE: We advise against using the disableHover Table prop when nesting Table Rows within a Table.

Table with Collapsible with Nested Table

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Alt HeaderAlt HeaderAlt HeaderAlt Header
ExpandedExpandedExpanded
Pill
ExpandedExpandedExpanded
Pill
ExpandedExpandedExpanded
Pill
Value 1Value 2Value 3Value 4Value 5Value 1Value 2Value 3Value 4Value 5

The collapsibleContent can also be used to display nested Tables within each Row.

NOTE: We advise against using the disableHover Table prop when nesting Tables within a Table.

Table with Clickable Rows

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Clickable table rows do not require any additional props. This doc example showcases how to set them up using html_options/htmlOptions and click events. Using the global prop for cursor to set it to "pointer" is also recommended for better UX.

Table with Selectable Rows

Column 1Column 2Column 3Column 4Column 5
picture of a misty forestValue 2Value 3Value 4Value 5
picture of a misty forestValue 2Value 3Value 4Value 5
picture of a misty forestValue 2Value 3Value 4Value 5

Use the Checkbox kit with the Table to achieve the selectable row functionality seen here.

Header Style Borderless

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Customize your header by removing the header borders with the headerStyle="borderless" prop.

Header Style Floating

Column 1Column 2Column 3Column 4Column 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5
Value 1Value 2Value 3Value 4Value 5

Further customize your header by using the table with background kit logic to give your table header a custom background color. Use the headerStyle="floating" prop to visually nest the borderless table within a card or collapsible with a matching background color (the backgroundColor passed to Background kit should match the background or backgroundColor for the element in which it is nested).


Available Props

PropsTypeValues

collapse

enum
"sm" | "md" | "lg"

container

enum
true

data

object
{ [key: string]: string; }

dataTable

enum
true

disableHover

enum
true

headerStyle

enum
"default" | "borderless" | "floating"

outerPadding

enum
"none" | "sm" | "md" | "lg" | "xxs" | "xs" | "xl"

responsive

enum
"none" | "collapse" | "scroll"

singleLine

enum
true

size

enum
"sm" | "md" | "lg"

sticky

enum
true

stickyLeftColumn

string[]
string[]

stickyRightColumn

string[]
string[]

striped

enum
true

tag

enum
"div"

verticalBorder

enum
true