Overview
A featured icon is a <span> with the nds-featured-icon class around one icon. It marks a card, a list item or a page section, and its color can report a status.
Pick another component when:
- the icon reports the result of a form field or a message: Feedback Icons
- the image is a person or an organization: Avatar
Markup
Variants
Every row goes on the .nds-featured-icon element. Pick one option from each group.
| Group | Option | Markup | On element | Use |
|---|---|---|---|---|
| Color | Brand (default) | — | — | The brand color, for an icon with no status to report |
| Color | Green | .nds-green |
.nds-featured-icon |
Success and confirmation. data-status="success" gives the same color and says the icon reports an outcome |
| Color | Blue | .nds-blue |
.nds-featured-icon |
Information and tips. data-status="info" gives the same color |
| Color | Yellow | .nds-yellow |
.nds-featured-icon |
A warning. data-status="warning" gives the same color |
| Color | Red | .nds-red |
.nds-featured-icon |
An error or a failure. data-status="error" gives the same color |
| Color | Neutral | .nds-neutral |
.nds-featured-icon |
General use, with no meaning of its own. data-status="neutral" gives the same color |
| Size | SM | .nds-sm |
.nds-featured-icon |
32px, for dense layouts such as table rows and side menus |
| Size | MD (default) | — | — | 40px. It needs no class |
| Size | LG | .nds-lg |
.nds-featured-icon |
48px, for section headers |
| Size | XL | .nds-xl |
.nds-featured-icon |
56px, for hero sections and landing pages |
| Shape | Rounded (default) | — | — | A square with rounded corners, for card headers and list items |
| Shape | Circle | .nds-circle |
.nds-featured-icon:not(.nds-subtle) |
A circle, beside round parts such as avatars |
| Style | Light (default) | — | — | A light fill in the icon’s color |
| Style | Outline | .nds-outline |
.nds-featured-icon |
No fill and a border in the icon’s color, for a lighter look |
| Style | Dark (hint: A solid fill and a white icon) | .nds-dark |
.nds-featured-icon |
A solid fill and a white icon, for the strongest emphasis |
| Style | Subtle (hint: The icon alone, with no container) | .nds-subtle |
.nds-featured-icon |
No container: the icon alone, two sizes smaller than the tiles. At MD it is 24px, and 32px in a card |
Built-in Features
-
Six Color Variants
Brand, success, info, warning, error and neutral. Each one sets the fill and the icon color through design tokens.
-
Status from a Parent
A
data-statuson a parent, such as a card or a drawer item, colors the featured icon inside it. An icon with its own color keeps it. -
Four Sizes
From 32px to 56px. The icon, the padding and the corner radius scale with
--featuredicon-size. -
Shape and Style Modifiers
A rounded square or a circle, with a light, outline, dark or subtle style. The circle does not apply to the subtle style.
-
Custom Color Override
Set
--featuredicon-bgand--featuredicon-coloron an icon with no color class to get a color pair beyond the six variants.
Best Practices
- Use a featured icon to mark a key item in a card, a definition list or a page section, where a plain icon would not stand out.
- Leave out the container for an icon that only decorates. A plain icon is lighter.
- Put one icon inside: any HGI font icon,
<i class="hgi hgi-stroke hgi-NAME">, or a UI icon,<i class="nds-icon nds-hgi-NAME">. - Give the icon
aria-hidden="true". The text next to the featured icon names the item for screen readers. - Pick the color by meaning. Use brand for main features and neutral for general items. Use success, info, warning or error for a status.
- Use
data-statuswhen the icon reports an outcome, and a color class when you want only the color. - In a modal, match the icon’s color to the message, such as red before the user deletes something.
- Use
nds-smin dense layouts such as table rows. Usends-lgornds-xlin hero sections and on landing pages. - Use
nds-circlebeside round parts such as avatars. Keep the rounded square in card headers and list items. - Use
nds-darkfor the strongest emphasis, andnds-outlinefor a lighter, secondary look.
API
Other Classes
| Class | Element | Effect |
|---|---|---|
nds-gray |
.nds-featured-icon |
The same as nds-neutral |
nds-md |
.nds-featured-icon |
The same as no size class: 40px |
Data Attributes
| Attribute | Element | Effect |
|---|---|---|
data-status |
.nds-featured-icon or any parent |
success, info, warning, error or neutral gives the matching color. critical gives the error color: keep it for system-level alerts |
CSS Custom Properties
Set these on the icon, in a style attribute or in your stylesheet. On a parent, they reach every featured icon inside it. --featuredicon-size wins over the size classes. The color classes and statuses set the three color properties.
| Property | Default | Controls |
|---|---|---|
--featuredicon-size |
40px |
Width and height. The icon, the padding and the corner radius scale with it |
--featuredicon-bg |
var(--featuredicons-background-primary-light) |
Fill |
--featuredicon-color |
var(--featuredicons-icon-primary) |
Icon color |
--featuredicon-dark-bg |
var(--background-primary) |
Fill of the nds-dark style |
--featuredicon-radius |
calc(var(--featuredicon-size) / 4 - 2px) |
Corner radius. nds-circle sets 50% |
--featuredicon-bg-forced, --featuredicon-color-forced, --featuredicon-dark-bg-forced |
— | The same three colors, set on a parent that must win over a color class on the icon. A plain knob set on a parent loses to the icon’s own class |
Tokens
Set a token at :root, or on a wrapper to reach every featured icon inside it. Give a token with a Dark mode value a dark override too: see Tokens.
Source: the featured-icons group in _sass/tokens/_components.scss.
| Token | Preview | Value |
|---|---|---|
--featuredicons-icon-oncolor | var(--colors-base-white) | |
--featuredicons-icon-success | var(--icon-success)Dark mode var(--colors-green-400) | |
--featuredicons-icon-default | var(--icon-default)Dark mode var(--colors-neutral-100) | |
--featuredicons-icon-error | var(--icon-error)Dark mode var(--colors-red-400) | |
--featuredicons-background-error-light | var(--background-error-light)Dark mode var(--colors-red-alpha-10) | |
--featuredicons-background-info-light | var(--background-info-light)Dark mode var(--colors-blue-alpha-10) | |
--featuredicons-background-warning-light | var(--background-warning-light)Dark mode var(--colors-yellow-alpha-10) | |
--featuredicons-background-success-light | var(--background-success-light)Dark mode var(--colors-green-alpha-10) | |
--featuredicons-background-primary-light | var(--background-primary-light)Dark mode var(--colors-primary-alpha-10) | |
--featuredicons-background-default-light | var(--colors-neutral-50)Dark mode var(--colors-alpha-white-10) | |
--featuredicons-background-neutral-light | var(--background-neutral-light)Dark mode var(--colors-alpha-white-10) | |
--featuredicons-icon-primary | var(--icon-primary)Dark mode var(--colors-primary-400) | |
--featuredicons-icon-neutral | var(--icon-neutral)Dark mode var(--colors-neutral-300) | |
--featuredicons-icon-info | var(--icon-info)Dark mode var(--colors-blue-400) | |
--featuredicons-icon-warning | var(--icon-warning)Dark mode var(--colors-yellow-400) |
It also reads these shared tokens. A change to one also changes other components.
Source: the var() reads in _sass/components/_featured-icon.scss.
| Token | Preview | Value |
|---|---|---|
--background-surface-oncolorRead by --featuredicon-dark-bg-forced | var(--colors-base-white) | |
--background-primaryRead by --featuredicon-dark-bg-forced, --featuredicon-dark-bg | var(--colors-primary-600) | |
--background-successRead by --featuredicon-dark-bg | var(--colors-green-600) | |
--background-infoRead by --featuredicon-dark-bg | var(--colors-blue-600) | |
--background-warningRead by --featuredicon-dark-bg | var(--colors-yellow-600) | |
--background-errorRead by --featuredicon-dark-bg | var(--colors-red-600) | |
--icon-oncolorRead by color | var(--colors-base-white) |