ctify

Table

Table is a component that allows you to display tabular data.

Usage

Props

Table

NameTypeDefaultDescription
childrenReactNodeThe elements that make up the table. Includes the TableHeader, TableBody, Columns, and Rows.
selectionBehaviorSelectionBehavior'toggle'How multiple selection should behave in the collection.
disabledBehaviorDisabledBehavior'selection'Whether disabledKeys applies to all interactions, or only selection.
dragAndDropHooksDragAndDropHooksThe drag and drop hooks returned by useDragAndDrop used to enable drag and drop behavior for the Table.
disabledKeysIterable<Key>A list of row keys to disable.
selectionModeSelectionModeThe type of selection that is allowed in the collection.
disallowEmptySelectionbooleanWhether the collection allows empty selection.
selectedKeys'all' | Iterable<Key>The currently selected keys in the collection (controlled).
defaultSelectedKeys'all' | Iterable<Key>The initial selected keys in the collection (uncontrolled).
sortDescriptorSortDescriptorThe current sorted column and direction.
classNamestringThe CSS className for the element. A function may be provided to compute the class based on component state.
styleReact.CSSPropertiesThe inline style for the element. A function may be provided to compute the style based on component state.

Events

NameTypeDescription
onRowAction(key: Key) => voidHandler that is called when a user performs an action on the row.
onSelectionChange(keys: Selection) => voidHandler that is called when the selection changes.
onSortChange(descriptor: SortDescriptor) => anyHandler that is called when the sorted column or direction changes.
onScroll(e: UIEvent<Element>) => voidHandler that is called when a user scrolls. See MDN.

TableHeader

NameTypeDescription
columnsobject[]A list of table columns.
childrenReactNode | (item: object) => ReactElementA list of Column(s) or a function. If the latter, a list of columns must be provided using the columns prop.
dependenciesany[]Values that should invalidate the column cache when using dynamic collections.
classNamestringThe CSS className for the element. A function may be provided to compute the class based on component state.
styleReact.CSSPropertiesThe inline style for the element. A function may be provided to compute the style based on component state.