Icon

The Icon component is a lightweight, scalable solution for embedding vector graphics. It enables easy reference to SVG symbols for a consistent and customizable icon system.

Examples

Here's an example of the Icon component in action:

<svg class="icon"> <use href="/assets/image/svg/icons.svg#icon-id"></use> </svg>
How It Works

The Icon component is a simple SVG element that references symbols from the icons.svg sprite sheet located at /assets/image/svg/. To display an icon, reference its ID using the format icons.svg#icon-id.

For example:

<use href="/assets/image/svg/icons.svg#star" />
Useful Info

Key points for using and customizing the Icon component:

  • The default icon color is set to currentColor, allowing it to inherit text color and adapt to theme changes.
  • Icons are styled with height: 1em; and aspect-ratio: 1; to maintain consistent size and proportions.
  • Use CSS to override size, color, and other properties globally or on individual icons.
  • Ensure accessibility by adding aria-hidden="true" for decorative icons or role="img" with aria-label for meaningful icons.
See Example