Lumo Icons
Lumo comes with a set of icons that are designed to fit in with the default Lumo style.
Available Icons
You can browse the icon set in the latest documentation.
Icons Size
Use the icon size custom properties to set consistent sizes for all icons across your application. The Lumo icons are drawn on a 24×24 pixel canvas – the <b>M size</b> fits that by default.
You need to import the style sheet for Sizing and Spacing to use the sizing properties.
--lumo-icon-size-s: 1.25em
--lumo-icon-size-m: 1.5em
--lumo-icon-size-l: 2.25em
Examples
SVG sprites
The SVG sprites are used with the iron-icon element.
HTML
<script type="module">
import '@vaadin/vaadin-lumo-styles/icons.js';
</script>
HTML
<iron-icon icon="lumo:edit"></iron-icon>
<iron-icon icon="lumo:cog"></iron-icon>
<iron-icon icon="lumo:search"></iron-icon>
Advanced usage
If you need to be in control of when or how iron-icon is imported, you may import iconset.html
(instead of icons.html
) to import only the icon definitions (iron-iconset-svg
) without automatically importing the iron-icon
element.
HTML
<script type="module">
import '@vaadin/vaadin-lumo-styles/iconset.js';
</script>
Font icons
Note, that the use of SVG icons is preferable over font icons. There are well documented caveats when using font icons.
HTML
<script type="module">
import '@vaadin/vaadin-lumo-styles/font-icons.js';
</script>
HTML
<span class="font-icon edit"></span>
<span class="font-icon cog"></span>
<span class="font-icon search"></span>
<custom-style>
<style>
.font-icon {
font-family: lumo-icons;
font-size: var(--lumo-icon-size-m);
}
.font-icon.edit::before {
content: var(--lumo-icons-edit);
}
.font-icon.cog::before {
content: var(--lumo-icons-cog);
}
.font-icon.search::before {
content: var(--lumo-icons-search);
}
</style>
</custom-style>
Icon size
HTML
<script type="module">
import '@vaadin/vaadin-lumo-styles/sizing.js';
</script>
HTML
<h5>SVG</h5>
<iron-icon icon="lumo:edit" class="size-s"></iron-icon>
<iron-icon icon="lumo:edit" class="size-m"></iron-icon>
<iron-icon icon="lumo:edit" class="size-l"></iron-icon>
<h5>Font icon</h5>
<span class="font-icon size-s"></span>
<span class="font-icon size-m"></span>
<span class="font-icon size-l"></span>
<custom-style>
<style>
.font-icon {
font-family: lumo-icons;
font-size: var(--lumo-icon-size-m);
vertical-align: middle;
}
.font-icon::before {
content: var(--lumo-icons-search);
}
/* Control iron-icons with width and height */
iron-icon.size-s {
width: var(--lumo-icon-size-s);
height: var(--lumo-icon-size-s);
}
iron-icon.size-m {
width: var(--lumo-icon-size-m);
height: var(--lumo-icon-size-m);
}
iron-icon.size-l {
width: var(--lumo-icon-size-l);
height: var(--lumo-icon-size-l);
}
/* Control font icons with font-size */
.font-icon.size-s {
font-size: var(--lumo-icon-size-s);
}
.font-icon.size-m {
font-size: var(--lumo-icon-size-m);
}
.font-icon.size-l {
font-size: var(--lumo-icon-size-l);
}
</style>
</custom-style>