Skip to content

hd-icon

Live preview

<hd-icon name="device.light" size="32px"></hd-icon><hd-icon name="device.light" weight="fill" size="32px" label="Light"></hd-icon>

Attributes and example

hd-icon

An icon from the icon registry, by semantic name, or any Phosphor icon.

AttributeWhat it is
namerequiredSemantic icon name, e.g. device.light or ui.close, a Phosphor icon as ph.<name> with underscores, e.g. ph.swimming_pool, or one picked in Homey as homeyicon.<name> (what {{ device.icon }} gives for a device with one).
weightIcon weight.One of regular, fill, duotone, bold. Default regular.
sizeCSS size, e.g. 24px or 1.5em.Default 1em.
labelAccessible label; without it the icon is decorative.
<hd-icon name="device.light" size="32px"></hd-icon><hd-icon name="device.light" weight="fill" size="32px" label="Light"></hd-icon>

Styling

Set CSS variables on the component element. Its internal elements live in Shadow DOM; only the exposed named parts can be styled with ::part.

--hd-icon-weight
`regular`, `bold` or `duotone`: the weight icons rest at, read by `hd-icon`.

Style the host

hd-icon {  --hd-accent: #2563eb;  max-width: 100%;}
Theme variables