Overview
TheDataTable component displays query results in a formatted, interactive table with features like sorting, searching, pagination, grouping, and custom column formatting.
Basic Usage
With Column Configuration
With Grouping
Props
Query result containing the data to display. Can be a Query object or array of objects.
Number of rows to display per page.
Title displayed above the table.
Subtitle displayed below the title.
Show row numbers in the first column.
Sorting
Initial sort column and direction. Format:
"column_name" or "column_name desc".Enable column sorting by clicking headers.
Search and Filtering
Enable search bar for filtering table data. Requires Query object.
Grouping
Column name to group rows by.
Display style for grouped rows.
accordion shows collapsible groups, section shows groups as table sections.Initial state for grouped rows (open or closed).
Vertical alignment of group name in section mode.
Show subtotal row for each group.
Show total row at bottom of table.
Table Features
Show download button to export table data.
Column name containing URLs to make rows clickable.
Show the link column in the table (by default it’s hidden).
Styling
Alternate row background colors.
Show lines between rows.
Use compact row spacing.
Allow column titles to wrap to multiple lines.
Automatically format column titles (e.g.,
snake_case to Snake Case).Background color for table header.
Font color for table header.
Background color for table body.
Background color for accordion group rows.
Background color for subtotal rows.
Font color for subtotal rows.
Background color for total row.
Font color for total row.
Error Handling
How to handle empty datasets.
Custom message to display when dataset is empty.
Column Component
Use nested<Column> components to customize individual columns: