Overview
A meta line is a <span> with the nds-meta class. Each fact in it is a <span> with the nds-meta-item class, which holds an icon and a short text. The line holds only inline elements, so it can sit inside a link or a button, such as a drawer row or a link card.
Pick another component when:
- each value needs a visible label, such as “Email” or “Mobile”: Definition List
- the fact is a category or a status: Tags
Markup
Variants
The Drawer row and Card structures show where the line goes inside those components: after the title part. Size goes on the .nds-meta line. Status goes on the one fact it colors: the builder puts it on the last fact.
| Group | Option | Markup | On element | Use |
|---|---|---|---|---|
| Structure | Line (default) | — | — | The facts on their own |
| Structure | Drawer row | canon #meta-drawer |
— | A list of items with details, such as classes or requests. The line goes in .nds-drawer-item, after .nds-drawer-item-head |
| Structure | Card | canon #meta-card |
— | A card with details under its text. The line goes in .nds-card-content, after .nds-card-text |
| Size | SM | .nds-sm |
.nds-meta |
12px text and a 14px icon, for a table cell or a dense list |
| Size | MD (default) | — | — | 14px text and a 16px icon, for a list row or a card |
| Size | LG | .nds-lg |
.nds-meta |
16px text and an 18px icon, under a page or an article title |
| Status | None (default) | — | — | The secondary text color, like the other facts |
| Status | Success | [data-status="success"] |
.nds-meta-item:last-child |
A fact that is done, such as “Paid” |
| Status | Info | [data-status="info"] |
.nds-meta-item:last-child |
A fact with news, such as a new room |
| Status | Warning | [data-status="warning"] |
.nds-meta-item:last-child |
A fact that needs attention soon, such as “Due in 2 days” |
| Status | Error | [data-status="error"] |
.nds-meta-item:last-child |
A fact that is late or failed, such as “Overdue 2 days” |
| Status | Neutral | [data-status="neutral"] |
.nds-meta-item:last-child |
A fact in the default text color, darker than the others |
Built-in Features
-
Inline Markup
The line and its facts are
<span>elements, so the line is valid inside a link or a button. -
Wrap to Fit
When the facts do not fit on one line, they wrap. Each fact moves down as a whole. Only a fact longer than the whole line wraps inside, and its icon stays beside its first line of text.
-
Icon Size in Buttons
Inside a button or a drawer row, the icon keeps the size of its line. The button's own icon size does not reach it.
-
Own Text Style
The line sets its own size, weight and color, so it reads as secondary text inside a button, a card or a row.
Best Practices
- Keep each fact short: a time, a place, a name or a reference number.
- Use two to four facts in a line. Put longer details in a Definition List.
- Pick an icon that names the fact, such as a clock for a time. A reader who sees only the icon must know what the text is.
- Give each icon
aria-hidden="true". The text names the fact for screen readers. - Use the same facts in the same order on every row of a list, so the reader can scan down a column.
- Put the status of the whole item in a Tag. Use
data-statuson a fact only when that one fact needs attention, such as a late due date. - Use
nds-smin a table cell andnds-lgunder a page title. Keep the default in list rows and cards. - Put a link inside a fact, such as an email address, only when the line is not inside a link or a button. A link inside a link is not valid HTML.
- Write a time or a phone number inside
<span dir="ltr">on an Arabic page, so its digits keep their order.
API
Classes
| Class | Element | Effect |
|---|---|---|
nds-meta |
<span> |
The line: a row of facts that wraps |
nds-meta-item |
<span> in the line |
One fact: an icon and its text, side by side |
nds-md |
.nds-meta |
The same as no size class: 14px text and a 16px icon |
Data Attributes
| Attribute | Element | Effect |
|---|---|---|
data-status |
.nds-meta-item |
success, info, warning, error or neutral gives the fact’s text and icon the matching color. critical gives the error color. A data-status on a parent, such as a drawer row, does not color the facts |
CSS Custom Properties
Set these on the line, or on a parent to reach every line inside it.
| Property | Default | Controls |
|---|---|---|
--meta-gap |
var(--spacing-xs) var(--spacing-lg) |
Space between the rows, then between the facts in a row |
--meta-color |
var(--text-secondary-paragraph) |
Text and icon color. A fact with data-status keeps its status color |
Tokens
It reads these shared tokens. A change to one also changes other components: see Tokens.
Source: the var() reads in _sass/components/_meta.scss.
| Token | Preview | Value |
|---|---|---|
--text-defaultRead by color | var(--colors-base-black)Dark mode var(--colors-neutral-200) | |
--text-secondary-paragraphRead by --meta-color | var(--colors-neutral-500)Dark mode var(--colors-neutral-400) | |
--text-successRead by color | var(--colors-green-700)Dark mode var(--colors-green-400) | |
--text-infoRead by color | var(--colors-blue-700)Dark mode var(--colors-blue-400) | |
--text-warningRead by color | var(--colors-yellow-700)Dark mode var(--colors-yellow-400) | |
--text-errorRead by color | var(--colors-red-700)Dark mode var(--colors-red-400) |