Create

General

Icon

Draft
Copy page View as Markdown Open in ChatGPT Open in Claude

Displays an SVG icon from the WDS icon set or your own registered icons.

Usage#

app.component.ts
import { WdsIconComponent } from '@wds/angular/icon';

The full list of icons is on the Iconography page. Register the set once with registerIcons(icons) before the first icon renders (see Register icons).

Examples#

Default#

Size#

size sets 12, 14, 16, 20 (default), 24 or 32px; --wds-icon-size sets any size.

Color#

The icon uses the text color (currentColor); --wds-icon-fill overrides it.

Button#

An icon-only button gets its name from label on wds-button.

New campaign Copy

Label#

Without label the icon is decorative. Add label when the icon alone carries meaning.

Verified

Tile#

tile puts the icon on a square surface twice its size: outline, elevated, frame, soft (a tint of the icon color) or solid (filled with it). Use it in list rows, feature cards and empty states.

Tile size#

The tile follows size: 24, 32, 40 (default), 48 or 64px. --wds-icon-tile-size sets any size, and the corners grow with the tile.

Round tile#

shape="circle" makes a round tile.

Tile color#

A text color class (or --wds-icon-fill) colors the icon; soft and solid tiles take their color from it. --wds-icon-tile-bg, --wds-icon-tile-border and --wds-icon-tile-fg override the parts.

Tile content#

Without name the tile shows its content: initials, a number or your own <svg>. Give it a label when the content means something on its own.

AI 2 MS

In a list and a card#

A tile in the media slot of wds-item, and at the top of a feature card.

On Manage
Webhooks
Send events to your own endpoints as they happen.

Stack#

tile="stack" adds two layers behind an outline tile, for a little depth in illustrations. Its height is 1.3 times the tile.

Stack in an empty state#

A stack as the illustration of wds-empty.

Create project

Register icons#

registerIcons() adds icons to a shared registry and can be called many times: the WDS set from @wds/core/icons and your own SVG. Icons already on the page update after registration. Register only trusted SVG, it is rendered as HTML.

API References#

wds-icon#

Displays an SVG icon by its name. Register icons first with registerIcons() (the WDS set: import { icons } from '@wds/core/icons'). The icon uses the text color and is hidden from screen readers unless it has a label. tile puts the icon on a square surface twice its size (e.g. in a feature card, a list row or an empty state); stack adds two layers behind the tile. Without name the element shows its content instead (initials, a number, your own <svg>).

Attributes

AttributeTypeDefaultDescription
namestring''Name of a registered icon, e.g. chevron-down.
sizeWdsIconSize'md'Size: 12, 14, 16, 20, 24 or 32px. --wds-icon-size sets any size.
labelstring''Accessible name. Without it the icon is decorative (aria-hidden="true").
tileWdsIconTile'none'Surface behind the icon, twice the icon size: outline (border), elevated (muted, raised), frame (a card in a muted ring), soft (a tint of the icon color), solid (filled with the icon color) or stack (an outline tile with two layers behind it).
shapeWdsIconShape'default'circle: a round tile.

Slots

SlotDescription
(default)Content shown when there is no name: text or an <svg>.

CSS parts (::part)

PartDescription
svgThe wrapper of the rendered <svg> (or of the content).
tileThe surface behind the icon (with tile).

CSS custom properties

PropertyDescription
--wds-icon-sizeWidth and height of the icon (set by size, default 1.25rem).
--wds-icon-fillIcon color (default currentColor). With tile="soft" and solid also the tile color.
--wds-icon-tile-sizeSize of the tile (default twice the icon size).
--wds-icon-tile-bgBackground of the tile.
--wds-icon-tile-borderBorder color of the tile.
--wds-icon-tile-fgIcon color on a solid tile (default --wds-background).

Accessibility#

Screen reader#

Without label the icon is hidden from screen readers (aria-hidden="true"). Use it next to a text that says the same thing.

With label the host has role="img" and aria-label, so screen readers announce the icon as an image with that name.

An icon inside a button does not name the button: an icon-only wds-button needs its own label.

Keyboard support#

The icon is not focusable and has no keyboard interaction.

Footer