Table events
| Type | Default value | Description | |
|---|---|---|---|
collapseAllHandleRef | React.RefObject<() => void> | undefined | Ref handle to collapse all expanded accordion rows. Send in a ref and use .current() to collapse all rows. |
Table Row <Tr> events
Table Row <Tr> events are a part of the mode feature and needs to be enabled with the mode property on the main Table.
Table with navigation mode(mode="navigation") only supports the <Tr> event onClick.
Table with accordion mode(mode="accordion") supports all the <Tr> events listed below.
| Type | Default value | Description | |
|---|---|---|---|
onClick | (event, { trElement }) => void | undefined | Will emit when user clicks/expands or on keydown space/enter (in mode="accordion" and mode="navigation") in the table row. The second argument is an object with trElement (the HTMLTableRowElement). |
onOpen | ({ target }) => void | undefined | Will emit when table row is expanded. Returns an object with the table row as the target: { target }. |
onClose | ({ target }) => void | undefined | Will emit when table row is closed (after it was open). Returns an object with the table row as the target: { target }. |
Table Data <Td> events
The <Td> onClick event renders a native <button> inside the cell for accessibility and provides element references in the second argument.
| Type | Default value | Description | |
|---|---|---|---|
onClick | (event, { trElement, tdElement, thElement, isSelected, setSelected }) => void | undefined | Will emit when user clicks the cell button. The second argument is an object with trElement (the parent HTMLTableRowElement), tdElement (the HTMLTableCellElement), thElement (the matching <Th> from <thead>, or null if not found), isSelected (current selected state), and setSelected (function to update the selected state — only effective when the selected prop is provided). |
icon | boolean IconIcon | true | Icon to show in the clickable cell. Set to true for the default chevron icon, or pass a custom icon. Set to false to hide the icon. Only takes effect when onClick is provided. |