Skip to main content

TableRow

TableRow is one row of a table: its cells followed by a last cell with the row's context menu button.

The Table README describes it in full.

TableRowTableRow

Props​

PropertyTypeDescription
fileContextClick((value?: boolean | undefined) => void) | undefinedCalled when the context menu is asked for, with true for a right-click.
childrenReactNodeRequired. The row's cells, normally one TableCell per column.
contextOptionsContextMenuModel[] | undefinedItems of the context menu; a non-empty list renders the three-dot button, an empty one leaves a blank space instead.
onHideContextMenu(() => void) | undefinedCalled when the context menu closes.
selectionProp{ className?: string | undefined; value?: string | undefined; } | undefinedClass and value spread onto the last cell, which holds the context menu button.
classNamestringundefinedClass applied to the row after the component's own.
styleCSSPropertiesundefinedInline styles of the row; inside a table the header overwrites its grid columns.
contextMenuCellStyleCSSPropertiesundefinedInline styles of the last cell.
titlestringundefinedHover tooltip of the three-dot button.
getContextModel(() => ContextMenuModel[]) | undefinedBuilds the context menu items at the moment the menu opens.
badgeUrlstringundefinedURL of a badge image shown in the context menu's header.
isIndexEditingModebooleanundefinedLeaves out the last cell with the context menu button, for rows being reordered. Default: false.
onClick((e: MouseEvent<Element, MouseEvent>) => void) | undefinedCalled with the mouse event on a click anywhere in the row.
onDoubleClick((e: MouseEvent<Element, MouseEvent>) => void) | undefinedCalled with the mouse event on a double click anywhere in the row.
forwardedRefForwardedRef<HTMLDivElement> | undefinedRef of the row element.
hideColumnsbooleanundefinedAdds a class for the narrow layout the header asks for when it runs out of room; the kit styles nothing with it. Default: false.
isActivebooleanundefinedMarks the row whose context menu is open: reveals children marked create-share-link and turns off the drop highlight. Default: false.
checkedbooleanundefinedAdds a checked class to the row for the consumer's highlight and reveals children marked create-share-link. Default: false.
draggingbooleanundefinedFills children marked droppable-hover with the drop colour while something is dragged over the table. Default: false.
dataTestIdstringundefinedValue of the row's data-testid attribute. Default: table-row.
contextMenuTestIdstringundefinedValue of the context menu's data-testid attribute.
onMouseEnter((e: MouseEvent<Element, MouseEvent>) => void) | undefinedCalled when the pointer enters the row.
onMouseLeave((e: MouseEvent<Element, MouseEvent>) => void) | undefinedCalled when the pointer leaves the row.

Stories​

Default​

A row with a context menu, the way rows in a file list offer their actions: right-click anywhere in the row, or click the three-dot button at its end.

DefaultDefault

Index Editing Mode​

While rows are being reordered the last cell with the context menu button is left out, so a drag cannot open a menu by accident (isIndexEditingMode).

Index Editing ModeIndex Editing Mode