Props
Introduction to Lens Data table Props.
Props
The Datatable
component accepts a variety of props to configure its behavior, styling, and interaction with backend view configuration. These props are passed down to the internal DataTableLensContextProvider
, which initializes the entire context system powering the table.
Prop Reference
onSelect
- Type:
Function
- Default:
() => {}
- Description: Callback triggered whenever row selection changes. It receives an array of selected row identifiers.
Example:
selectedItems
- Type:
string[]
- Default:
[]
- Description: Preselect rows in the table using their identifier keys.
Example:
classNames
- Type:
object
- Description: Customize the styling of different parts of the table such as headers, rows, cells, etc.
Example:
disableResizing
- Type:
boolean
- Default:
false
- Description: Disables column resizing functionality when set to
true
.
Example:
viewId
- Type:
string
- Description: Identifies which Lens view configuration to use for rendering the table. Useful when multiple views exist on the same entity.
Example:
rowActions
- Type:
object
- Description: Map of actions to render in specific cells. Keys should match column IDs defined in the backend config. Used for things like edit buttons, links, or custom renderers.
Example:
actionsMapping
- Type:
object
- Description: Optional map to override or transform default cell actions. Allows injection of scoped logic or button renderers based on view permissions or external logic.
Example:
Summary Table
Prop | Type | Default | Description |
---|---|---|---|
onSelect | (selected: any[]) => void | () => {} | Callback when rows are selected |
selectedItems | string[] | [] | Preselected row keys |
classNames | TableStylingInterface | undefined | Custom styling for table UI |
disableResizing | boolean | false | Disable column resizing |
disableReordering | boolean | false | Disable column Ordering feature |
viewId | string | undefined | View ID from Lens to load config |
rowActions | Record<string, Function> | undefined | Custom renderers for specific columns |
actionsMapping | ActionsMappingPropInterface | undefined | Scoped action renderers for specific row context |