Data Table Component
Data tables are powerful ways to display tabular data, like what you find in a CSV or SQL database.
Override the data
property with the row-formatted data source (an array of objects with consistent keys). Often, this data is the result of a function (e.g. {{pgQuery1.data}}
).
Data tables come batteries-included with support for:
- Column controls (sizing, filtering, sorting, ordering, pinning)
- Infinite scroll and pagination
- Row selection / auto-advance
- Downloading the underlying data
- Cell formatting
- Row actions
- Custom cells (coming soon)
All data tables are virtualized and therefore remain performant when scrolling through large numbers of rows.
Properties
Visible
Prop | isVisible |
---|---|
Type | boolean |
Default | true |
Whether or not this node is visible.
Enabled
Prop | isEnabled |
---|---|
Type | boolean |
Default | true |
Whether or not this node is enabled.
Tooltip
Prop | tooltip |
---|---|
Type | string |
Default | undefined |
The tooltip text to display when hovered or focused over this node.
Top
Prop | top |
---|---|
Type | number |
Default | 1 |
The position of the node from the top side of the grid (grid-row-start
).
Left
Prop | left |
---|---|
Type | number |
Default | 1 |
The position of the node from the left side of the grid (grid-column-start
).
Width
Prop | width |
---|---|
Type | string |
Default | 640px |
The width of the node. When this node is in a grid layout, this should be done using unitless grid column units (specifying 4
will become grid-column-end: span 4
). When this node is in a stack layout, the width can be specified using CSS units (e.g. 100px
or 100%
), or be left unitless to be treated as flex-grow for the node.
Min Width
Prop | minWidth |
---|---|
Type | string |
Default | undefined |
The minimum width of the node. When this node is in a grid layout, this property is ignored.
Max Width
Prop | maxWidth |
---|---|
Type | string |
Default | undefined |
The maximum width of the node. When this node is in a grid layout, this property is ignored.
Height
Prop | height |
---|---|
Type | string |
Default | 480px |
The height of the node. When this node is in a grid layout, this should be done using unitless grid row units (specifying 4
will become grid-row-end: span 4
). When this node is in a stack layout, the height can be specified using CSS units (e.g. 100px
or 100%
), or be left unitless to be treated as flex-grow for the node.
Min Height
Prop | minHeight |
---|---|
Type | string |
Default | undefined |
The minimum height of the node. When this node is in a grid layout, this property is ignored.
Max Height
Prop | maxHeight |
---|---|
Type | string |
Default | undefined |
The minimum height of the node. When this node is in a grid layout, this property is ignored.
Overflow
Prop | overflow |
---|---|
Type | Overflow ('auto' | 'visible' | 'hidden' | 'scroll') |
Default | auto |
The strategy used to handle overflow in the horizontal and vertical axes for content that is larger than its container.
Overflow X
Prop | overflowX |
---|---|
Type | Overflow ('auto' | 'visible' | 'hidden' | 'scroll') |
Default | auto |
The strategy used to handle overflow in the horizontal axis for content that is larger than its container.
Overflow Y
Prop | overflowY |
---|---|
Type | Overflow ('auto' | 'visible' | 'hidden' | 'scroll') |
Default | auto |
The strategy used to handle overflow in the vertical axis for content that is larger than its container.
Custom Styles
Prop | styles |
---|---|
Type | string |
Default | ::component { } |
Custom CSS styles to be applied to the node. Use element.styles
to refer to the current node.
Object Fit
Prop | objectFit |
---|---|
Type | ObjectFit ('none' | 'contain' | 'cover' | 'fill' | 'scale-down') |
Default | cover |
The strategy used to set how the content of a replaced element should be resized to fit its container.
Data Source
Prop | data |
---|---|
Type | unknown |
Default | [ { email: '[email protected]', joined: '2021-01-03', verified: true, }, { email: '[email protected]', joined: '2021-03-02', verified: false, }, ] |
The table data in row-wise format. An array of objects with consistent keys, this is often the result of a function (e.g. {{pgQuery1.data}}
).
Auto Columns
Prop | autoColumns |
---|---|
Type | boolean |
Default | true |
When true, columns will automatically be added when data changes. When false, columns must be manually specified.
Columns
Prop | columns |
---|---|
Type | array |
Default | [] |
The column configuration for the data table.
Column Configuration
Prop | columns[] |
---|---|
Type | object |
Default | undefined |
Options for each column
Column Header
Prop | columns[].header |
---|---|
Type | string |
Default | undefined |
The text to show at the top of the column
Key
Prop | columns[].accessor |
---|---|
Type | string |
Default | undefined |
The property in the data to read for this column
ID
Prop | columns[].id |
---|---|
Type | string |
Default | undefined |
A unique ID for this column
Width
Prop | columns[].width |
---|---|
Type | number |
Default | undefined |
The desired width for the column
Minimum Width
Prop | columns[].minWidth |
---|---|
Type | number |
Default | undefined |
The minimum width for the column
Width Unit
Prop | columns[].widthUnit |
---|---|
Type | string |
Default | undefined |
The unit of the width value
Min Width Unit
Prop | columns[].minWidthUnit |
---|---|
Type | string |
Default | undefined |
The unit of the min-width value
Render As
Prop | columns[].renderAs |
---|---|
Type | ColumnRenderingMethod ('default' | 'date' | 'time' | 'datetime' | 'boolean' | 'json' | 'raw' | 'button' | 'link' | 'text' | 'number' | 'image') |
Default | undefined |
The format to use when rendering the column
Datetime format
Prop | columns[].dateTimeFormat |
---|---|
Type | string |
Default | undefined |
A format string for datetimes in this column, (formatting reference) (opens in a new tab)
Is Visible
Prop | columns[].isVisible |
---|---|
Type | boolean |
Default | undefined |
Should the column be shown in the table
Pinned Direction
Prop | columns[].pinnedDirection |
---|---|
Type | PinnedDirection ('none' | 'left' | 'right') |
Default | undefined |
The direction in which the column is pinned
Allow Sorting
Prop | columns[].allowSortBy |
---|---|
Type | boolean |
Default | undefined |
Should the column be sortable
Link Text
Prop | columns[].linkText |
---|---|
Type | string |
Default | undefined |
The text to display on the link
Target
Prop | columns[].linkTarget |
---|---|
Type | LinkTargetMethod ('_self' | '_blank' | '_parent' | '_top') |
Default | undefined |
Specify the context in which the linked resource will open.
Button Text
Prop | columns[].buttonText |
---|---|
Type | string |
Default | undefined |
The text to display on the button
On Click
Prop | columns[].onButtonClick |
---|---|
Type | ({ function: { ref: string } } | null) |
Default | undefined |
What function will be called when the button is clicked
Text Color
Prop | columns[].buttonTextColor |
---|---|
Type | string |
Default | undefined |
The text color of the button's label.
Background Color
Prop | columns[].buttonBackgroundColor |
---|---|
Type | string |
Default | undefined |
The background color of the button.
Order Key
Prop | columns[].orderKey |
---|---|
Type | string |
Default | undefined |
The key specifying the fractional index of this column
Precision
Prop | columns[].precision |
---|---|
Type | number |
Default | undefined |
The precision to display the number at in terms of number of significant figures after the decimal point.
Rounding
Prop | columns[].rounding |
---|---|
Type | Rounding ('floor' | 'ceil' | 'round' | 'trunc') |
Default | undefined |
The rounding behavior of the number value.
Prefix
Prop | columns[].prefix |
---|---|
Type | string |
Default | undefined |
The text to display before the number.
Suffix
Prop | columns[].suffix |
---|---|
Type | string |
Default | undefined |
The text to display after the number. Useful for units.
Image Style
Prop | columns[].imageStyle |
---|---|
Type | ImageStyle ('square' | 'circle') |
Default | undefined |
The presentation style of the image.
Flatten
Prop | flatten |
---|---|
Type | boolean |
Default | false |
Whether or not to flatten the data source's keys. For example, if the data table receives a deeply nested row object like [{ "foo": { "bar": "baz", "qux": "quux" }]
, it will flatten these keys to two columns named foo.bar
and foo.qux
.
Allow Export
Prop | allowExport |
---|---|
Type | boolean |
Default | false |
Whether or not to allow the user to download the underlying table data. This will not prevent sophisticated users or adversaries from accessing the data table directly, and therefore should not be used for purposes of securing the underlying data from prying eyes.
Export Format
Prop | exportFormat |
---|---|
Type | DataTableDownloadFormat ('CSV' | 'JSON') |
Default | JSON |
The format of the document you receive when exporting table data.
Selected Row
Prop | selectedRow |
---|---|
Type | unknown |
Default | undefined |
The currently selected row of the data table. This property contains the row object itself, and so can be used to access keys on the underlying object.
Selected Row Index
Prop | selectedRowIndex |
---|---|
Type | number |
Default | undefined |
The currently selected row's index within the data table. This property will reflect the numeric index within the data source that is selected. 0-indexed — the first row is 0
, second row is 1
, etc.
Select First Row
Prop | autoselectFirstRow |
---|---|
Type | boolean |
Default | false |
Whether or not to auto-select the first row of the data table upon initialization. Useful for auto-advancing through items in the data table, such as when building approval workflows.
Pagination
Prop | paginationEnabled |
---|---|
Type | boolean |
Default | false |
Exposes the pagination controls for the user to bind to function calls
Page Size
Prop | pageSize |
---|---|
Type | number |
Default | undefined |
Number of rows per page, used to set parameters on paginated query
Current Offset
Prop | paginationOffset |
---|---|
Type | number |
Default | 0 |
Offset to begin data query from, used to set parameters on paginated query
Current Page
Prop | currentPage |
---|---|
Type | number |
Default | 1 |
Current page being displayed
Total Rows
Prop | totalRowCount |
---|---|
Type | number |
Default | undefined |
Number of entries in the data set, used to set bounds on pagination
Show Header
Prop | showHeader |
---|---|
Type | boolean |
Default | true |
Whether the header of the data table is visible.
Header Height
Prop | headerHeight |
---|---|
Type | string |
Default | 36px |
The height of the header of the data table, in pixels.
Show Footer
Prop | showFooter |
---|---|
Type | boolean |
Default | true |
Whether the footer of the data table is visible.
Footer Height
Prop | footerHeight |
---|---|
Type | string |
Default | 36px |
The height of the footer of the data table, in pixels.
Show Stripes
Prop | showStripes |
---|---|
Type | boolean |
Default | false |
Whether the background of the data table body is striped.
Show Border
Prop | showBorder |
---|---|
Type | boolean |
Default | true |
Whether the outside border of the data table is visible.
Border Radius
Prop | borderRadius |
---|---|
Type | string |
Default | 6px |
The radius of the rounding of the corners of the data table. Set to 0
to have no rounded corners.
Table Border Color
Prop | tableBorderColor |
---|---|
Type | string |
Default | table.border |
The color of the outside border of the data table.
Header Background Color
Prop | headerBackgroundColor |
---|---|
Type | string |
Default | background.chrome |
The background color of the data table's header.
Header Text Color
Prop | headerTextColor |
---|---|
Type | string |
Default | text.primary |
The text color of the data table's header.
Header Border Color
Prop | headerBorderColor |
---|---|
Type | string |
Default | table.border |
The border color of the data table's header.
Row Background Color
Prop | rowBackgroundColor |
---|---|
Type | string |
Default | table.background |
The background color of the rows of the data table.
Alternate Row Background Color
Prop | alternateRowBackgroundColor |
---|---|
Type | string |
Default | table.alternate |
The background color of the alternate rows of the data table when stripes are enabled. If no color is specified and stripes are enabled, the alternate row color will be determined automatically.
Row Text Color
Prop | rowTextColor |
---|---|
Type | string |
Default | text.primary |
The text color of the rows of the data table.
Row Border Color
Prop | rowBorderColor |
---|---|
Type | string |
Default | table.border |
The border color of the rows of the data table.
Row Hover Background Color
Prop | rowHoverBackgroundColor |
---|---|
Type | string |
Default | table.alternate |
The background color of a row when the user hovers over it.
Selected Row Background Color
Prop | rowSelectedBackgroundColor |
---|---|
Type | string |
Default | table.border |
The background color of a selected row.
Selected Row Text Color
Prop | rowSelectedTextColor |
---|---|
Type | string |
Default | text.primary |
The text color of a selected row.
Footer Background Color
Prop | footerBackgroundColor |
---|---|
Type | string |
Default | background.chrome |
The background color of the data table's footer.
Footer Text Color
Prop | footerTextColor |
---|---|
Type | string |
Default | text.primary |
The text color of the data table's footer.
Footer Border Color
Prop | footerBorderColor |
---|---|
Type | string |
Default | table.border |
The border color of the data table's footer.
Row Height
Prop | rowHeight |
---|---|
Type | string |
Default | 36px |
The height of each row in the data table, in pixels.
Event Handlers
On Wheel
Handler | dataTableNode.onWheel |
---|
Called when the user scrolls the node. Use this event to trigger downstream actions when this node is scrolled.
On Hover
Handler | dataTableNode.onHover |
---|
Called when the user hovers on the node. Use this event to trigger downstream actions when this node is hovered.
On Leave
Handler | dataTableNode.onLeave |
---|
Called when the user is not hovering over the node. Use this event to trigger downstream actions when this node is no longer hovered.
On Select Row
Handler | dataTableNode.onSelectRow |
---|
Called when selecting a row. Use this event to trigger downstream changes
On Refresh
Handler | dataTableNode.onRefresh |
---|
Called when the refresh button is clicked. Use this event to trigger downstream changes