StartFoundationsComponentsContent

Icon

An icon draws one glyph from the Thykes icon font, sized from the icon scale and colored like the text around it.

Stable
OverviewUsageAPIAccessibility
<tk-icon name="star"></tk-icon>
<tk-icon name="mail"></tk-icon>
<tk-icon name="settings"></tk-icon>

thykes.js loads the icon font; you load nothing else.

Anatomy

Part What it is
tk-icon a square box at size; hidden from screen readers unless it has a label
glyph part the drawing, a character in the icon font, in the host's color

Sizes

<tk-icon name="star" size="12"></tk-icon>
<tk-icon name="star"></tk-icon>
<tk-icon name="star" size="20"></tk-icon>
<tk-icon name="star" size="24"></tk-icon>
<tk-icon name="star" size="32"></tk-icon>
<tk-icon name="star" size="48"></tk-icon>
size Box Use
12 12px next to small text, dense status
16 (default) 16px next to body text, in menus and controls
20 20px next to larger text
24 24px on its own, navigation
32 32px prominent
48 48px large, on its own, such as an empty state
inherit 1em follows the font size of the text around it

The sizes are the icon-size-* tokens. Any other value draws at 16px.

Color

<tk-icon name="check-circle" tone="success" label="Done"></tk-icon>
<tk-icon name="warning" tone="warning" label="Warning"></tk-icon>
<tk-icon name="info" tone="info" label="Info"></tk-icon>
<tk-icon name="star" tone="accent"></tk-icon>
<tk-icon name="clock" tone="secondary"></tk-icon>

Without tone, the icon takes the text color around it, so inside a component it follows the component's states and themes. On its own, tone sets an icon/* color:

tone Color
unset the text color around it
default, secondary, tertiary icon/default, icon/secondary, icon/tertiary, from strongest to quietest
disabled icon/disabled
accent icon/accent; follows the primary color
success, warning, error, info the status colors
inverse, on-fill on an inverse surface or a colored fill

There is no selected tone. A selected control colors its own icon.

In components

Save changes

3 unread messages

<tk-button variant="primary"><tk-icon slot="icon-start" name="check"></tk-icon>Save changes</tk-button>
<tk-icon-button label="Settings"><tk-icon name="settings"></tk-icon></tk-icon-button>
<p><tk-icon name="mail"></tk-icon> 3 unread messages</p>

Inside a component slot, the component sets the size and your size has no effect. tk-button, tk-icon-button, tk-menu-item, and tk-tag draw icons at 16px; tk-banner and tk-section-message at 20px; tk-empty-state at its media size.

Names

Names are lowercase and hyphenated, and say what the icon means. The Icons page shows every glyph.

Group Names
Navigation menu, chevron-up, chevron-down, chevron-left, chevron-right, arrow-up, arrow-down, arrow-right, arrow-up-right, external-link, link
Actions search, plus, minus, close, check, edit, copy, trash, download, share, filter, sort, settings, more-horizontal
Status info, warning, error, check-circle, x-circle
Objects bookmark, bookmark-filled, star, mail, user, calendar, clock, image, monitor, sun, moon
Brands github, figma

An unknown name draws an empty box and logs a warning.