Icon Tile
An icon tile sets one icon in a square or a circle tinted in the color of its intent: the accent, a neutral gray or the color of a state. It marks the start of a notice, a step or a figure.
Without a label the tile is decoration and hidden from screen readers, which suits it beside a heading that says the same. With one it is an image with that name.
Basic Usage
Intents
accent is the default, and primary names it too, as it does on a button. Each tint is the color of the intent mixed into the page's background, with the icon in the matching text color, so a tile reads the same on a card and on the page.
Sizes and Shapes
The sizes are the steps sm, md and lg of the kit's size ladder, and the icon grows with the tile. A square tile takes the corner radius of the same step.
In a Notice
Two-factor sign-in is off
Turn it on before the end of the month to keep access to the payroll exports.
The heading beside the tile says what the icon says, so the tile stays decoration.
A Tile With a Name
Quarterly plan
Where nothing beside the tile says what it means, give it a label. The tile becomes one image with that name, and the icon inside it stays decoration.
A Mark of Your Own
The slot takes a mark of your own in place of icon, such as a small SVG. It is drawn in the tile's text color through currentColor:
<x-wirekit::icon-tile intent="success" label="Verified">
<svg viewBox="0 0 16 16" class="h-4 w-4" aria-hidden="true">
<path d="M3 8l3 3 7-7" fill="none" stroke="currentColor" stroke-width="2" />
</svg>
</x-wirekit::icon-tile>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
icon |
string|null | null |
The name of an icon of the active preset. The slot takes its place when it is given |
intent |
string | 'accent' |
accent (also primary), neutral, info, success, warning, danger |
size |
string | 'md' |
sm, md, lg |
shape |
string | 'square' |
square, circle |
label |
string|null | null |
What the icon says. Given, the tile is an image with that name; left out, it is hidden from assistive technology |
scope |
string|null | null |
Scoped personalization name |
Accessibility
- Without a
labelthe tile carriesaria-hidden="true". That is right beside a heading, a sentence or a button that says the same: the icon repeats it, and a screen reader would read it twice. - With a
labelthe tile isrole="img"with the label as its name, and the icon inside it stays hidden, so the tile is read once, as one image. A label given as markup is read as its text. - A caller's own
aria-labeloraria-hiddenwins over both, so a tile that a nearby element names througharia-labelledbykeeps that name. - The icon takes the text color of its intent, the tone the kit uses for text on a tinted surface.
Keyboard Interaction
This component is purely presentational and does not respond to keyboard input.
Design Tokens
| Token | Used for |
|---|---|
--color-wk-accent, --color-wk-info-tone, --color-wk-success, --color-wk-warning, --color-wk-danger |
The tint, mixed into --color-wk-bg |
--color-wk-accent-text, --color-wk-info-text, --color-wk-success-text, --color-wk-warning-text, --color-wk-danger-text |
The icon's color |
--color-wk-bg-muted, --color-wk-text |
The neutral tile |
--size-wk-sm, --size-wk-md, --size-wk-lg |
The tile's width and height |
--radius-wk-sm, --radius-wk-md, --radius-wk-lg |
The corners of a square tile |