Organizes structured content so that it is easy to scan, make comparisons, and analyze the data
The default table is medium sized, bordered, full width, and has responsive overflow scrolling.
Alternating light/dark backgrounds.
Adds border between rows
This is an advanced example with multiple headers and a custom class to change the background color for headers inside <tbody>
Many WCAG requirements are contextual to their implementation. To ensure that usage of this component complies with accessibility guidelines you are responsible for the following:
WCAG level A requirements:
<th>
<th scope="col">
and <th scope="row">
) is highly recommended, though not always necessary (i.e. if all cells in the first row are marked as <th>
without scope, most modern screen readers will infer that the scope is the column below each header cell).WCAG level AA requirements:
<table>
.
Note: Even if the data are not represented in a table, WCAG 1.3.1 requires the data to be associated with their labels.<caption>
or name (e.g. via aria-label or aria-labelledby).<caption>
of a table SHOULD describe the identity or purpose of the table accurately, meaningfully, and succinctly.This component has compliance with WCAG guidelines by:
cdr-table
like cdr-grid
is a wrapper component without predetermined layout requirements. This allows you the flexibility to construct the structure you need to accurately display the data you have. There are cases where you might need to change background colors or add additional borders (see the advanced example). When this is done, tokens for the table colors (background, border, etc.) should be used so your customizations can persist through future cedar updates.striped
name
Boolean
type
false
default
Sets row colors to alternate between darker and lighter backgrounds. Striping will not apply when `border` is true
border
name
Boolean
type
true
default
Adds borders between rows. Will disable `striped` if both are true
full-width
name
Boolean, string
type
true
default
Sets the width to 100%. Also accepts space separated strings for breakpoints that it should be full width: { '@xs' | '@sm' | '@md' | '@lg' }
responsive
name
Boolean
type
true
default
Makes the table scroll horizontally when it would overflow its container
hover
name
Boolean
type
false
default
Adds a darker background on row hover
size
name
string
type
'medium'
default
Sets the table size (cell padding); values can target responsive breakpoints. Breakpoint values are: xs, sm, md, and lg. Examples: { 'small' | 'medium' | 'large' | 'large@sm' }