The page navigation is complete. You may now navigate the page content as you wish.
Skip to main content

Got a minute? We’d like your feedback! Take the survey

Tables

Writing guidance for tabular data.

This documentation provides best practices for writing tabular content in Table and Advanced Table components.

General recommendations

While we are not prescriptive about what goes into table cells, there are some best practices to consider:

Icon usage

Icons used within cells can help differentiate content, highlight metadata, increase text hierarchy, or enhance text. Use the outlined icon style in most cases. However, if contrast with other icons is important, you can use the filled style.

Don’t

Don’t use an icon as the sole content within a cell, even if the icon is explicit, e.g., a brand or service icon.

Icon within a table without a label

Don’t

Don’t use an icon to indicate the status of an object, row, or resource. Instead, use a Badge.

Icons being used for status

Service icons

Use service icons within a cell to communicate the source or provider of a service.

Service icon within a table

Grouping

Use icons to communicate commonalities between values or that a value is part of a larger object or hierarchical structure.

Icons used for grouping in a table

Product branding

Use icons to communicate that a specific item is a HashiCorp product or resource.

Icon product branding

Don’t

Don’t use an Icon Tile in place of an icon within a table cell.

Icon Tile within a table cell

Leading vs. trailing icons

We recommend using leading icons so the text following the icon remains aligned down the column for better scannability.

Don’t mix and match different icon positions in the same column.

We recommend using secondary Inline Links within tables, to avoid overloading the UI with the actionable blue color used by the primary color variant.

To increase the prominence and further differentiate links from other text content, we recommend using a font-weight of medium. In code, you can use the CSS helper classes hds-typography-body-200 and hds-font-weight-medium. In Figma, you can use the text style Body/200/Link.

Link example

If a table contains more than one column of links, consider using a font-weight of medium for only the most important links, usually the title of the row or ID. For the other links, use a font-weight of regular.

Multiple links within a table

If a cell contains long-form or descriptive content, use the link style that is most appropriate for the hierarchy and frequency of links within the content. For a minimal number of links, primary Inline Links may be appropriate, but if there are many links within the content secondary Inline Links may work better.

Links in long-form content

Badge usage

Use Badges to communicate status and high-priority metadata within tables. Ensure that Badge usage within tables is consistent across features and within an application holistically so that it is easier to understand and quicker to parse.

Badge type

We recommend using outlined Badges within tables. This variant provides sufficient differentiation between the component, the value in the cell, and the background of a table row without being too visually heavy.

Outlined Badges within a table

Badge color

Use Badge color logically to communicate status within tables.

Active
Degraded
Failed
Starting up
No status

Badge icon usage

Use logical icons when communicating status in a Badge. Some common examples when paired with Badge color include:

Do

In the case of a null or empty value, use the text-only variant of the Badge.

Null value represented by a badge within a table

Badge size

Use the medium Badge size by default as this creates more visual consistency between the Badge and text values within tables.

If the table row density is set to short, use the small Badge size to account for the reduction in vertical spacing and padding.

Small badge in a short density table

Don’t

Don’t use the large Badge size in tables as this elevates the Badge too prominently in the hierarchy and can create inconsistency between Badges and text.

Large badge within a table

Don’t

Don’t use different Badge sizes in the same table.

Different badge sizes in a table

Null values

Null cell values

If records within a table contain empty or null values, don’t reflect this literally with an empty cell. While a literal representation of a data set may seem logical when showcasing tabular data, a null value still intrinsically has an attribute of none or empty which should be communicated to user.

An empty cell can impact the user experience negatively by:

Don’t

Null empty cells

Instead, explicitly communicate null values to the user and represent them with a similar visual treatment as non-null values.

Do

Visually represent null values in an inverse and comparative manner with non-null values.

Null value communicated with text

Styling null values

In cells that contain values represented by text, use the same text style as non-null values in the column (in most cases this is Body / 200 / Regular). Consider reducing the prominence of the null values by using Foreground / Faint color instead of Primary or Strong.

Null value in a text string

Null values with badges

In cells that contain a badge (e.g., status, health, etc), communicate null values by using a neutral color badge to maintain visual consistency with other non-null cells.

Null value communicated in a badge

Null value fallback

As a fallback, consider using an em dash (—) in place of the null value. This may occur when the content type of a value isn’t able to be determined or if the value is null for an unknown reason.

Null value communicated with an em-dash

Communicating why a value is null

Depending on the data set and the type of content it expresses, consider communicating to the user why a value is null by using a Tooltip. This can communicate broader product-specific functions and terminology, but can also highlight errors or issues that need to be corrected.

Null value cause communicated with a tooltip

Null or empty table state

In the case of an entire data set returning null or empty, use Application State to communicate this and provide the user with next steps to correct the problem or create a new record in the data set.

Common examples of this include:

Null data set within a table


Related