Skip to content zachleat Project

🚾Web Component Star Search

A searchable catalog of standalone web components.

<vaadin-icon>

`<vaadin-icon>` is a Web Component for displaying SVG icons.

Category
Media
Built with
Lit
Library
Vaadin
Author
Vaadin
Package
@vaadin/icon
Component size
6.4 kB JS (minified + gzipped, JS includes dependencies beyond the library)
Library size
19.9 kB JS (shared by every Vaadin component, loaded once per page)
Popular
4 out of 5
Downloads
273,304/week · jsDelivr 3,878 hits/month (whole @vaadin/icon package)
Latest stable version
25.3.2
Last published
Component last changed
(in 25.3.0)
License
Apache-2.0

<vaadin-icon> is a Web Component for displaying SVG icons.

Icon property

The <vaadin-icon> component is designed to be used as a drop-in replacement for <iron-icon>. For example, you can use it with vaadin-icons like this:

<vaadin-icon icon="vaadin:angle-down"></vaadin-icon>

Alternatively, you can also pick one of the Lumo icons:

<vaadin-icon icon="lumo:user"></vaadin-icon>

Custom SVG icon

Alternatively, instead of selecting an icon from an iconset by name, you can pass any custom svg literal using the svg property. In this case you can also define the size of the SVG viewBox using the size property:

import { html, svg } from 'lit';

// in your component
render() {
  const svgIcon = svg`<path d="M13 4v2l-5 5-5-5v-2l5 5z"></path>`;
  return html`
    <vaadin-icon
      .svg="${svgIcon}"
      size="16"
    ></vaadin-icon>
  `;
}

Styling

The following custom CSS properties are available for styling:

Custom CSS property
--vaadin-icon-color
--vaadin-icon-size
--vaadin-icon-stroke-width
--vaadin-icon-visual-size

The following state attributes are available for styling:

Attribute Description
has-tooltip Set when the icon has a slotted tooltip

See Styling Components documentation.

Attributes