DataTable
DataTable is a 2-dimensional data structure where each row is an item, and each column is a data point about the item.
Page navigation navigation
React examples
Default
Repositories
Repository | Type | Updated | Dependabot | Code scanning |
---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | |
aegir | Public | Alerts | Report secrets | |
strapi | Public | |||
codeql-ci-nightlies | Public | Alerts | ||
dependabot-updates | Public | |||
tsx-create-react-app | Public | |||
bootstrap | Public | Alerts | ||
docker-templates | Public | Alerts |
With custom column widths
Repositories
grow w/ 200px max | growCollapse w/ 100px min | auto | 200px | undefined (defaults to grow) |
---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | |
aegir | Public | Alerts | Report secrets | |
strapi | Public | |||
codeql-ci-nightlies | Public | Alerts | ||
dependabot-updates | Public | |||
tsx-create-react-app | Public | |||
bootstrap | Public | Alerts | ||
docker-templates | Public | Alerts |
Columns text alignment
- Left (default): Follows natural reading direction in right-to-left writing systems.
- Right-aligned columns are used for numbers and other data that is best represented right-aligned.
In this example, there is a "Pull requests" column that is right-aligned to make it easier to visually scan and compare the numbers.
Repositories
Repository | Pull requests | Type | Updated |
---|---|---|---|
codeql-dca-worker | 12 | Internal | |
aegir | 34 | Public | |
strapi | 8 | Public | |
codeql-ci-nightlies | 1 | Public | |
dependabot-updates | 57 | Public | |
tsx-create-react-app | 35 | Public | |
bootstrap | 42 | Public | |
docker-templates | 3 | Public |
Table cell density
- Condensed: Maximizes data visibility in a small area.
- Normal (default): Balances data display with whitespace for clarity.
- Spacious: Enhances readability for dense or complex content.
This example uses 'spacious'
table cell padding.
Repositories
Repository | Type | Updated | Dependabot | Code scanning |
---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | |
aegir | Public | Alerts | Report secrets | |
strapi | Public | |||
codeql-ci-nightlies | Public | Alerts | ||
dependabot-updates | Public | |||
tsx-create-react-app | Public | |||
bootstrap | Public | Alerts | ||
docker-templates | Public | Alerts |
Sort rows by column data
If a table is sortable, one column must be sorted by default. Clicking a sorted column toggles between ascending and descending; unsorted columns sort in ascending order on first click.
In this example, the rows are sortable by "Repository" and "Updated" column data.
Repositories
Type | Dependabot | Code scanning | ||
---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | |
aegir | Public | Alerts | Report secrets | |
strapi | Public | |||
codeql-ci-nightlies | Public | Alerts | ||
dependabot-updates | Public | |||
tsx-create-react-app | Public | |||
bootstrap | Public | Alerts | ||
docker-templates | Public | Alerts |
With title and subtitle
Repositories
A subtitle could appear here to give extra context to the data.
Repository | Type | Updated | Dependabot | Code scanning |
---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | |
aegir | Public | Alerts | Report secrets | |
strapi | Public | |||
codeql-ci-nightlies | Public | Alerts | ||
dependabot-updates | Public | |||
tsx-create-react-app | Public | |||
bootstrap | Public | Alerts | ||
docker-templates | Public | Alerts |
With table action
Repositories
A subtitle could appear here to give extra context to the data.
Repository | Type | Updated | Dependabot | Code scanning |
---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | |
aegir | Public | Alerts | Report secrets | |
strapi | Public | |||
codeql-ci-nightlies | Public | Alerts | ||
dependabot-updates | Public | |||
tsx-create-react-app | Public | |||
bootstrap | Public | Alerts | ||
docker-templates | Public | Alerts |
With single row action
Actions that affect the item represented in the row are placed in the last column, and they don't require a visible column header.
Repositories
Repository | Type | Updated | Dependabot | Code scanning | Actions |
---|---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | ||
aegir | Public | Alerts | Report secrets | ||
strapi | Public | ||||
codeql-ci-nightlies | Public | Alerts | |||
dependabot-updates | Public | ||||
tsx-create-react-app | Public | ||||
bootstrap | Public | Alerts | |||
docker-templates | Public | Alerts |
With multiple row actions
If you have multiple actions for a row, start by pulling them into a dropdown menu.
If one of the actions is heavily used, pull it out for easier access. Do not pull out more than 1 action.
Row actions in a dropdown
Repository | Type | Updated | Dependabot | Code scanning | Actions |
---|---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | ||
aegir | Public | Alerts | Report secrets | ||
strapi | Public |
Row actions inline
Repository | Type | Updated | Dependabot | Code scanning | Actions |
---|---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | ||
aegir | Public | Alerts | Report secrets | ||
strapi | Public |
Row actions overflowing
Repository | Type | Updated | Dependabot | Code scanning | Actions |
---|---|---|---|---|---|
codeql-dca-worker | Internal | Alerts | Report secrets | ||
aegir | Public | Alerts | Report secrets | ||
strapi | Public |
With paginated rows
The pagination footer shows the user where they are in relation to the total number of rows and provides controls for navigating all rows.
Guidelines on when to paginate rows
Repositories
Repository | Type | Updated | Dependabot | Code scanning |
---|---|---|---|---|
Repository 1 | Internal | |||
Repository 2 | Public | |||
Repository 3 | Public | |||
Repository 4 | Internal | |||
Repository 5 | Public | |||
Repository 6 | Public | |||
Repository 7 | Internal | |||
Repository 8 | Public | |||
Repository 9 | Public | |||
Repository 10 | Internal |
In a loading state
DataTables use "skeleton" loading states to indicate loading content.
Repositories
Repository | Type | Updated | Dependabot | Code scanning |
---|---|---|---|---|
Loading | Loading | Loading | Loading | Loading |
More code examples
The previous examples are a curated subset of the full capabilities of the DataTable
component. For more examples, see the DataTable Storybook stories.