KANTO DS v1.12.0
Customise

Theme

Accent

Font

Corners

Density

Text size

Reset to Kanto
Core

kt-icon

GitHub Copy link

A Lucide icon, resolved from the registry by name.

Preview

A Lucide icon, resolved from the registry by name.

Default 24px, stroke width 2, drawn in currentColor — the icon takes the colour of the text around it, with no attribute to keep in sync.

<kt-icon name="search"></kt-icon> <kt-icon name="trash-2" size="16"></kt-icon> <kt-icon name="circle-alert" style="color: var(--color-danger-base)"></kt-icon>

Registering icons

Kanto ships the 24 icons its own elements draw and nine a first screen reaches for — plus, pencil, settings, download, upload, external-link, filter, ellipsis, refresh-cw. Register whatever else the application uses, once, at start-up:

import { Rocket, Wallet } from 'lucide'; import { registerIcons } from 'kanto-ds/icons'; registerIcons({ Rocket, Wallet }); // now <kt-icon name="rocket">

Names normalise to kebab-case, so Rocket, rocket and ROCKET all resolve to rocket.

Prototyping and can afford the weight? Register the lot:

import * as lucide from 'lucide'; registerIcons(lucide); // ~2000 icons, do not ship this

Accessibility

By default the icon is aria-hidden — correct for the common case, where it sits next to text that already names the action.

Give it a label only when it carries meaning alone, which makes it role="img" with that accessible name:

<!-- text says it; icon is decoration --> <kt-button icon="trash-2">Delete</kt-button> <!-- icon says it; it needs a name --> <kt-icon name="trash-2" label="Delete"></kt-icon>

API

PropertyAttributeTypeDefaultDescription
namenamestring''Registered icon name, kebab-case.
sizesizenumber24Width and height, in pixels.
strokeWidthstroke-widthnumber2SVG stroke width.
labellabelstring''Accessible name. Empty = hidden.
PartDescription
svgThe <svg> root

An unknown name renders an empty box of the right size and warns once in the console — a typo shifts no layout while you find it.