跳到主要内容

TableCell

TableCell is one cell of a TableRow: a fixed-height box that sits in the column the table's grid gives it.

The Table README describes it in full.

TableCellTableCell

Props​

PropertyTypeDescription
className?stringundefinedClass applied to the cell after the component's own.
hasAccess?booleanundefinedShows the child marked table-container_row-checkbox in place of the child marked table-container_element while the pointer is over the cell. Default: false.
checked?booleanundefinedShows the child marked table-container_row-checkbox in place of the child marked table-container_element all the time. Default: false.
forwardedRef?ForwardedRef<HTMLDivElement> | undefinedRef of the cell element.
style?CSSPropertiesundefinedInline styles applied to the cell.
children?ReactNodeContent of the cell: text or elements.
value?stringundefinedWritten onto the cell as a value attribute, which drag and drop reads to identify the item.
dataTestId?stringundefinedValue of the cell's data-testid attribute. Default: table-cell.
documentTitle?stringundefinedWritten onto the cell as a data-document-title attribute.

Stories​

Default​

A cell holding plain text, the most common case; change any other prop live in the Controls panel below.

DefaultDefault

With Element​

An avatar that turns into a checkbox when the pointer is over the cell, so a row can be picked without a separate checkbox column (hasAccess). Hover the cell to see the swap.

With ElementWith Element

With Element Checked​

Once the row is selected the checkbox stays in place of the avatar even without the pointer over it (checked).

With Element CheckedWith Element Checked

With Element No Access​

Without hasAccess the cell keeps the avatar on hover and never shows the checkbox, for a row the user may not select.

With Element No AccessWith Element No Access