Use tables to present large amounts of data, and data which has multiple properties attached to it.
How to use Table
- Make sure Tables span the full width of the container they're in
- Make sure a table has a header describing the content of its respective columns
- Ordered columns by relevance from left to right. Images, if present, have a higher priority, and should be placed in the first column. Checkboxes naturally have the highest priority.
Code examples
Content guidelines
- Keep headers short
- Headers should be informative and descriptive
- Content in the table should be concise and scannable
Props
Table
- Name
className
DescriptionCSS class to be appended to the root element
string - Name
layout
Default"inline""embedded"inline - Name
testId
DescriptionA [data-test-id] attribute used for testing purposes
Defaultstringcf-ui-table
Table.Head
- Name
children(required)
ReactNode - Name
className
DescriptionCSS class to be appended to the root element
string - Name
isSticky
Defaultfalsetruefalse - Name
offsetTop
stringnumber - Name
testId
DescriptionA [data-test-id] attribute used for testing purposes
Defaultstringcf-ui-table-head
Table.Body
- Name
children(required)
ReactElement<any, string | JSXElementConstructor<any>> | ReactElement<any, string | JSXElementConstructor<any>>[] - Name
className
DescriptionCSS class to be appended to the root element
string - Name
testId
DescriptionA [data-test-id] attribute used for testing purposes
Defaultstringcf-ui-table-body
Table.Row
- Name
children(required)
ReactNode - Name
className
DescriptionCSS class to be appended to the root element
string - Name
isSelected
Defaultfalsetruefalse - Name
testId
DescriptionA [data-test-id] attribute used for testing purposes
Defaultstringcf-ui-table-row
Table.Cell
- Name
align
Default"left""center""right"left - Name
children
ReactNode - Name
className
DescriptionCSS class to be appended to the root element
string - Name
sorting
Defaultfalsetrue"asc""desc"false as TableCellSorting - Name
testId
DescriptionA [data-test-id] attribute used for testing purposes
Defaultstringcf-ui-table-cell - Name
width
stringnumber