Table and related components Table Row, Table Header, and Table Cell provide a way to organize and present tabular data or content.
Overview
Table should be used to present tabular data, content, or information to a user.
Usage
- Display tabular data to a user
- Organize content by row and column
Sample
Best Practices
Table is an effective way of organizing complex data and content that may have many dimensions. For less complex displays of content collections that do not require row and column relationships, consider List.
Recommendations
It is important to slot Table Rows into the appropriate "table-header"
or "table-footer"
slot. Doing so ensures assistive technologies can accurately associate cells and their related context. While the "table-header"
and "table-footer"
slots are not required, Table Rows should be slotted appropriately when used.
Selection modes
Table offers "single"
and "multiple"
selection
values in addition to the default of "none"
. When enabled, Table displays the current number of selected Table Rows to a user, along with an affordance to clear their selection.
When selection
is not "none"
, the "selection-actions"
slot will display alongside the provided selection interface. When used with page
, selected rows that are no longer in view will be indicated to a user.
selectionMode
when there are associated actions or workflows.selectionMode
when displaying Table Rows that represent selectable entities a user may take action on.selectionMode
when there are no associated user interactions.selectionMode
with complex rowSpan
and colSpan
configurations.Selection displays
When selection
is not "none"
, and selection
is "top"
(the default configuration) - the Table component provides visual affordances for selection count and clearing selection to the user. When in this default display, the selection-actions
slot can be useful to populate with related contextual actions.
There are times when this selection
and associated content slot may not be desirable; when applicable, the selection
property can be set to "none"
. This configuration can be useful where the selection count and clear selection affordances are not needed, such as when Tables contain a known and small number of rows, or when an interface should not allow a user to clear a selection. It can also facilitate the creation of alternative or unique selection interfaces for specific use cases.
Pagination
Enable pagination by providing a page
. When enabled, Table Rows slotted into the "table-header"
or "table-footer"
slot will remain visible to a user, while Table Rows slotted into the default slot are paginated.
When used with selection
other than "none"
, selected rows that are no longer in view will be indicated to a user.
pageSize
when there may be a large or overwhelming number of Table Rows.pageSize
of reasonable length.pageSize
when there is an expectedly low number of Table Rows.pageSize
value.Accessibility
Keyboard navigation
Key | Function |
---|---|
Arrow down | Navigates to a calcite-table-cell or calcite-table-header in the next calcite-table-row . |
Arrow up | Navigates to a calcite-table-cell or calcite-table-header in the previous calcite-table-row . |
Page Up | Navigates to a calcite-table-cell or calcite-table-header in the first visible calcite-table-row . |
Page Down | Navigates to a calcite-table-cell or calcite-table-header in the last visible calcite-table-row . |
Home | Navigates to the first calcite-table-cell or calcite-table-header in the current calcite-table-row . |
End | Navigates to the last calcite-table-cell or calcite-table-header in the current calcite-table-row . |
Control and Home | Navigates to the first calcite-table-cell or calcite-table-header in the first calcite-table-row . |
Control and End | Navigates to the last calcite-table-cell or calcite-table-header in the last calcite-table-row . |