Icon
A simple icon component that uses the Iconify library to render icons.
Showcase
<LnxButton icon="pixelarticons:heart" :size="42" />
When to use
- Next to text, to make it quicker to scan: in buttons, menus or messages.
- On its own only when its meaning is obvious. If it is the only content of a button, give the button an
aria-label. - Any Iconify icon works: write its set and name, like
mdi:home.
Examples
Size and color
Icons are 1.4 times the size of the text around them and take its color. Use size (in px) and the color CSS property to change them.
vue
<LnxIcon icon="mdi:home" />
<LnxIcon icon="mdi:home" :size="32" />
<LnxIcon icon="mdi:alert" :size="32" style="color: var(--lnx-color-warning)" />1
2
3
2
3
Inside a button
vue
<LnxButton mode="outline">
<template #prefix>
<LnxIcon icon="mdi:download" />
</template>
Download
</LnxButton>1
2
3
4
5
6
2
3
4
5
6
API
Props
| Prop | Type | Description |
|---|---|---|
icon | string | Name of the icon. All Iconify icons are supported, see the full list here Default: `` |
size | number | Display size of the icon expressed in px |
Native attributes
| Attribute | Type | Description |
|---|---|---|
rotate | number | Rotates the icon by the specified degrees, but only in 90-degree increments. If you want custom degrees, use CSS transformations Default: "0deg" |
flip | boolean | Flips the icon horizontally or vertically Default: "none" |
style | string | You can only change the color of monotone icons. It is applied by changing the color CSS attribute of the iconDefault: "color: undefined;" |