Components
Table
Use with caution: availableExamples
Borderless table (default)
View va-table v3 default in Storybook
Borderless with custom markup
View va-table with custom markup in Storybook
Borderless with missing data
View va-table with missing data in Storybook
Borderless with pagination
View va-table with pagination in Storybook
Sortable
View Sortable va-table in Storybook
Usage
Additional guidance for VA
Using the standard table
- Wrap instead of truncate content. This reduces confusion in case headers start with the same word.
Using responsive stacked tables
- Arrange data in order of importance Because the leftmost columns are what users see first in a smaller screen, work with a content specialist and determine what order of columns is going to tell the best story with that data. Which columns are most critical to understanding what the meaning of the table is? Ask users what the most important data is to them and have that be the first column.
- Left align header and value in list view When using list view, the header and value are stacked vertically with the bolded header on one line and the value on the line below. Make sure both header and value are left aligned.
- Limit characters in headings Column headings shouldn’t exceed 60 characters. Follow content guidelines on how to abbreviate dates and time, as well as, other abbreviations and acronyms
-
Tables should have a maximum of 5 columns Very large tables with lots of columns are difficult to use. This problem only gets exacerbated on smaller screens. Show only what users really need.
- Use the responsive list view table when you need to present a list of information in an itemized way. A responsive stacked table collapses at narrow widths for better readability on small screens.
- Use the standard table when users have to compare rows and columns as the table layout remains the same on smaller screens.
- For comparison tables, avoid horizontal scrolling and limit the number of columns to 3 or fewer. All column heading labels should total no more than 60 characters.
Code usage
Attributes and Properties
fullWidth
full-width
boolean
false
When active, forces the table to expand to the full-width of its container
rightAlignCols
right-align-cols
string
A comma-separated, zero-indexed string of which columns, if any, should be right-aligned
scrollable
scrollable
boolean
false
When active, the table can be horizontally scrolled and is focusable
sortable
sortable
boolean
false
If true, the table is sortable. To use a raw sort value for a cell, add a data-sort-value attribute to the span element.
stacked
stacked
boolean
true
Convert to a stacked table when screen size is small
True by default, must specify if false if this is unwanted
striped
striped
boolean
false
When active, the table will display alternating row background colors.
tableTitle
table-title
string
The title of the table
tableType
table-type
"borderless"
'borderless'
The type of table
Content considerations
- The
table-title
, which the component will place in a<caption>
element, should succinctly describe the table in a meaningful way.
Accessibility considerations
Additional guidance for VA
- Tables should be used to display tabular data, which is structured data made up of rows and columns. A table allows the information to be easily interpreted by visually associating row and column headers.
- Do not use tables for layout purposes. Tables should only be used for data that has inherent relationships, not for design purposes.
Component checklist
Maturity
-
Guidance - Examples, usage, code usage, content considerations, and accessibility considerations are all complete.
-
Research - VFS team conducted research on this component which is linked from this page.
-
Stability - Component has been in production for more than 3 months with no significant issues found.
-
Adoption - Multiple teams have adopted this component.
Accessibility
While this component has been previously tested against older criteria, it has not yet been audited with the updated testing criteria.
Code assets
-
Variations - Storybook includes all variations (style, size, orientation, optional iconography, selection, error state, etc.)
-
Responsive - Component depicted in all responsive breakpoints.
-
Interactive states - Includes all interactive states that are applicable (hover, active, focus, keyboard focus, disabled).
-
Tokens - All design attributes (color, typography, layout, etc.) are available as tokens.
-
Internationalization - Describes i18n attributes.
Visual assets
-
Variations - Figma library includes all variations (style, size, orientation, optional iconography, selection, error state, etc.)
-
Responsive - Component designed to work in all responsive breakpoints.
-
Interactive states - Includes all interactive states that are applicable (hover, active, focus, keyboard focus, disabled).
-
Tokens - All design attributes (color, typography, layout, etc.) are available as tokens.
Legend:
-
Complete -
Incomplete -
Not applicable