DataTable

Figma
Github
Storybook

DataTable enables users to act upon complex datasets with a variety of features including filtering and sorting.

Anatomy

[WIP image]

  1. Header: Contains search, filters, column settings, sort controls, and saved views. All header features are optional.
  2. Column headers: Labels each column. Sortable columns display a sort indicator on interaction.
  3. Row: A single data record. Rows may be selectable, expandable, or clickable depending on configuration.
  4. Cell: An individual data value within a row. Cells can render plain text, formatted values, or custom components like labels.
  5. Pagination: Navigation controls displayed below the table when pagination is enabled.

Guidelines

Tables are used to display, organize, compare, or format tabular data. Our DataTable is an opinionated and custom table built for users to multiselect rows, sort, and filter the data to their needs. While the DataTable is intended for more complex datasets with multiple fields, it can still be used for simple sets.

Tables for layout

Historically, HTML tables were once used to arrange elements on a webpage before modern CSS layout tools like flexbox and grid existed. Never use the DataTable or any table for layout purposes. We provide components specialized in building layouts, such as the Box and Grid. For more information and the full list of available components, see our "Layout" section under "Components."

DataTable features

The DataTable includes, but is not limited to, the following list of features.

  • Pagination
  • Row selection
  • Search and filtering
  • Sorting

We recommend only adding the most necessary features as too many options may be overwhelming for users. For the complete list of features, see Behaviors.

Best practices

Column count

It's not uncommon for more complex datasets to include more fields. These fields are represented by additional columns. The more columns that are included by default, the more difficult it becomes for the user to understand the data presented. Keep only the minimum amount of columns necessary for data to be visible and readable. Allow users the option to show and hide extra columns as necessary.

Be aware that horizontal scrolling is only available for non-fixed DataTables.

Locations
Location
Region
Climate
Elevation (ft)
Terrain
Avg temp
Maple RidgeNorthTemperate2,450Hills52°F
Cedar BayWestMaritime120Coastal61°F
Pine ValleyCentralContinental890Valley48°F
Aspen CreekEastSubtropical1,560Forest66°F
Do: Allow users to customize visible columns.
Locations
Location
Region
Climate
Elevation (ft)
Terrain
Avg temp
Rainfall
Nearest city
Access road
Maple RidgeNorthTemperate2,450Hills52°F38 inSpringfieldRoute 7
Cedar BayWestMaritime120Coastal61°F45 inRiversideHighway 1
Pine ValleyCentralContinental890Valley48°F28 inMidtownRoute 30
Aspen CreekEastSubtropical1,560Forest66°F52 inLakewoodRoute 12
Don't: Show every available column at once.

Types

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Basic

Basic tables are non-interactive and more suitable for simpler, comparative lists of data.

1–4 of 4
Locations
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
1–4 of 4
Interactive

Interactive tables include functionality for users to act on the available data, including search, filter, sorting, and row selection.

Appearance

Layout

Layout determines how the DataTable reacts to its content. By default, tables are fixed in size and cells will not accommodate their content. Use fixed layouts for predictable table sizing.

Auto layout allows cells to accommodate their content size and enables horizontal scrolling. Use auto layouts when column content must be easily readable.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Fixed

Columns are divided equally regardless of cell content size. Horizontal scrolling is disabled.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Auto

Columns adjust automatically to cell content size. Horizontal scrolling is enabled.

Columns

Width

Column widths may be customized to defined widths or constrained to minimum and maximum width values.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Defined widths

Columns can be set to defined width values.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Min/max widths

Columns can be constrained by minimum and maximum values.

Rows

Highlighting

Highlighting changes a row's background color on mouse hover. Rows are highlighted automatically when they're selectable, but this can be manually enabled on non-selectable rows.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Hover highlight

Rows are highlighted on mouse hover.

Styles

In addition to the base styles, the DataTable includes two additional row styles: striped and borderless.

Striped style alternates between two neutral background colors to improve the table's readability. This can be helpful for tables with large amounts of data, especially where infinite scrolling is enabled.

Borderless style removes the border between rows. This can be used for a cleaner presentation on tables with smaller datasets.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Base

Rows have a consistent background color with a border between each entry.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Striped

Rows alternate between two background colors to improve readability.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Borderless

Rows have no borders separating each entry.

Behaviors

States

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Base

At rest, the table displays existing data with no active interactions.

Locations
Location
Region
Climate
Elevation (ft)
Loading

Skeleton loaders are displayed while data is being returned. Expected row count can be estimated by setting a predefined number of rows.

Locations
Location
Region
Climate
Elevation (ft)

No results found

Try adjusting your search or filters.

Empty

Empty states display when there is no data to show. Use the existing empty state or provide a custom empty state to help users understand how to proceed.

Locations
2 selected
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Selected

Selected rows are highlighted with a blue background and checked input field.

Filter

Filters let users narrow down results by selecting from predefined options, such as a status or category. Filters appear in the table header and can be combined to refine the data shown.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Filter

Filter controls appear in the header, allowing users to select criteria and narrow the displayed results.

Infinite scrolling

Enabling infinite scrolling (virtualization) allows the table to load large datasets incrementally without a drop in performance as the user scrolls. This can be used an alternative to pagination.

Locations
Location
Region
Climate
Elevation (ft)
Infinite scrolling

Infinite scrolling allows large datasets to be scrolled without performance issues.

Pagination

Pagination allows users to handle large datasets by separating them into different pages. Controls are displayed under the table and allow the user to select how many results are displayed per page.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
1–2 of 4
Pagination

Pagination is used to control how many results are displayed at once for larger datasets.

Search enables users to filter table data by keyword. The search input is located in the table header and filters across all columns by default. For large datasets, use manual (server-side) search to avoid performance issues.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Search

Search enables users to filter data by keyword using an input field in the table header.

Columns

Column management

Column settings allow users to show and show columns as needed. Extra columns are accessed through a dropdown menu within the table header.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Column settings

Columns can be toggled for visibility through a dropdown menu in the table header.

Column span

Cells may span multiple columns if necessary. This can be used to show that information may not be available or communicate inline status messages about the associated entry.

Users
Name
Email
Role
Alicealice@example.comAdmin
Bob
Charliecharlie@example.comViewer
Dianadiana@example.comAdmin
Column span

Cells can span multiple columns. This is useful for conveying special information about this entry.

Sorting

Column sorting allows users the flexibility to organize data. Sorting can be done either by activating a column header or selecting options from the "Sort" dropdown in the table header. Sorting is handled in either ascending or descending order.

Locations
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Column sorting

Sorting is enabled by activating a column header or the dropdown in the table header.

Rows

Actions

Actions such as editing, deleting, or viewing row details can be performed on individual rows. Row actions are placed within a dropdown menu in the last cell of each row.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Row actions

Row actions such as edit and delete are housed within a dropdown menu in the last cell of the row.

Bulk actions

Bulk actions appear in the table header when one or more rows are selected. The main, promoted action renders as a button separate from the actions within the dropdown button.

Locations
2 selected
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Bulk actions

When rows are selected, the header transforms to show the selection count and available bulk actions.

Expansion

Similar to an accordion, row expansion displays additional information about the row directly under it without forcing the user to navigate away from the table. Rows that can be expanded are denoted by an expansion toggle icon.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Expandable rows

Rows with expansion toggle icons can be expanded to reveal supplementary information about that row.

Selection

Row selection allows users to pick one or more rows to act on. Selected rows are visually highlighted with a checked input and different background color. Row selection allows users to perform bulk actions on multiple entries at once.

Locations
Location
Region
Climate
Elevation (ft)
Maple RidgeNorthTemperate2,450
Cedar BayWestMaritime120
Pine ValleyCentralContinental890
Aspen CreekEastSubtropical1,560
Row selection

Each row includes a checkbox for selection. A header checkbox selects or deselects all visible rows.

Content

Caption

DataTable captions are important for providing assistive technology information about the table's purpose and the type of data it contains. Short, descriptive nouns or noun phrases work best for captions.

Note: Captions are not visible to the user but are required for displaying the table.

Location data
Do: Use a short, descriptive label that identifies the data.
Data points describing various locations' geographical information.
Don't: Use longer sentences.

Column headers

Column headers should clearly describe the data in each column. Write headings in sentence case and avoid abbreviations where possible.

Locations
Location name
Region
Elevation (ft)
Maple RidgeNorth2450
Cedar BayWest120
Do: Use full words in sentence case.
Locations
Loc Nms
Rgn
Elv
Maple RidgeNorth2450
Cedar BayWest120
Don't: Use abbreviated header or title case.

Empty states

Provide a clear and meaningful Empty State message and action when no data is available. This ensures users that the component is functioning correctly but may need data or user attention.

Locations
Location
Region
Climate
Elevation (ft)

No locations yet

Add your first location to get started.

Do: Use an empty state to communicate when data is missing.
Locations
Location
Region
Climate
Elevation (ft)

No data available

Don't: Leave the table empty with no context.