Components
Back to catalog
Component detail entry
General
@vean/ui
SIcon

Icon

Icon belongs to the General category. Start with demos and usage, then use the API tables to finish integration and styling decisions.

Use the quick jump panel to reach overview, usage, demos, and API first, then continue through the full page.

Quick jump

Related components

If you are composing interactions in the same family, these components usually pair well together.

Icon

Overview

SIcon is a unified icon component built on top of Iconify. It supports rendering icons from the Iconify dataset or custom components/VNodes. It integrates with SConfigProvider for consistent sizing across the application.

Features

  • 📦 Iconify Support: Render any icon from the massive Iconify library.
  • 🔧 Custom Icons: Support for Vue components, VNodes, or raw strings.
  • 📏 Global Sizing: Inherits default size from SConfigProvider.
  • 🎨 Styling: Easy customization via props or CSS classes.
  • ♿ Accessibility: Decorative icons are aria-hidden by default; semantic icons are exposed via aria-label / aria-labelledby.

Basic Usage

Using Iconify Name

<script setup lang="ts">
import { SIcon } from '@vean/ui';
</script>

<template>
  <SIcon icon="lucide:home" />
  <SIcon icon="mdi:account" class="text-primary" />
</template>

Custom Size

<template>
  <SIcon icon="lucide:settings" width="24" height="24" />
</template>

You can also set a default size globally via SConfigProvider:

<script setup lang="ts">
import { SConfigProvider, SIcon } from '@vean/ui';
</script>

<template>
  <SConfigProvider :iconify="{ width: '1.5rem', height: '1.5rem' }">
    <SIcon icon="lucide:home" />
  </SConfigProvider>
</template>

Custom Icon Component

<script setup lang="ts">
import { SIcon } from '@vean/ui';
import CustomIcon from './CustomIcon.vue';
</script>

<template>
  <SIcon :icon="CustomIcon" />
</template>

Accessibility

  • Decorative icons (default): aria-hidden="true" is set automatically, hiding the icon from assistive technology.
  • Semantic icons: pass aria-label or ariaLabelledby and aria-hidden will not be set, making the icon visible to assistive technology.
<template>
  <!-- Decorative: aria-hidden="true" -->
  <SIcon icon="lucide:check" />

  <!-- Semantic: aria-label exposes the icon -->
  <SIcon icon="lucide:check" aria-label="Completed" />
</template>

API

Aria Layer

1

Icon

4 Props
Props
PropTypeDefaultDescription
icon
IconValue
—
Icon rendered by the component.
ariaHidden
boolean
—
Whether the icon is hidden from assistive technology. Defaults to `true` for decorative icons. Set to `false` or provide `ariaLabel` / `ariaLabelledby` to expose the icon.
ariaLabel
string
—
Accessible label for the icon. When provided, `aria-hidden` is not set so the label is announced.
ariaLabelledby
string
—
ID of an element that labels the icon. When provided, `aria-hidden` is not set so the label is announced.

Notes

Architecture and benchmark differences

VeanUI splits the icon into an Aria layer (_icon in @vean/aria, providing the IconValue type and render hook) and a styled layer (SIcon in @vean/ui, wrapping Iconify rendering, size inheritance, and accessibility logic). This differs from single-package libraries such as Ant Design, Element Plus, MUI, Mantine, and Naive UI.

AspectVeanUIAnt Design / Element Plus / MUI / Mantine / Naive UI
ArchitectureAria + styled splitsingle package
Icon sourceIconify (200+ icon sets, on-demand loading)built-in icon set / custom SVG
StylingUnoCSS utility classesCSS-in-JS / SCSS / CSS vars
Sizingprop + SConfigProvider global inheritanceprop / token
Accessibilitydecorative/semantic auto-distinction, smart aria-hidden defaultmanual aria-label

FAQ

Why is aria-hidden="true" set by default? Most icons are decorative and serve only as visual aids. Defaulting to aria-hidden="true" prevents screen readers from announcing meaningless icon names. When an icon carries semantic meaning, pass aria-label or ariaLabelledby and aria-hidden is automatically removed.

How do I use an Iconify string name? Pass a string in the icon="prefix:name" format, e.g. icon="lucide:home". Iconify loads the icon data on demand from its API. You can also pre-register icon data via addIcon / addCollection for offline use.

How do I rotate or flip an icon? Use hFlip for a horizontal mirror, vFlip for a vertical mirror, rotate for rotation, and inline for baseline alignment. These props are forwarded to Iconify:

<template>
  <SIcon icon="lucide:arrow-right" :h-flip="true" />
  <SIcon icon="lucide:refresh-cw" rotate="90deg" />
  <SIcon icon="lucide:home" inline />
</template>

rotate accepts a string (e.g. "90deg") or a number of quarter turns (e.g. 1 for 90°, 2 for 180°).

How does SConfigProvider size priority work? The width / height props passed directly take precedence over the iconify.width / iconify.height configured in SConfigProvider.

Is SSR supported? Yes. The Iconify component renders an empty placeholder in SSR environments and loads icon data after client hydration. For instant SSR rendering, pre-register icon data.

Changelog

Version history is grouped by release so you can quickly see what changed for this component across published versions.

v0.40.0

2026-09-14

Compare release

Fix

allow hydration mismatch for async-loaded icons

Scope: iconAuthors: soybeanfeView commit17a16

Fix

allow hydration mismatch for async-loaded icons

Scope: iconAuthors: soybeanfeView commit17a16

v0.30.0

2026-08-20

Compare release

Feature

optimize icon props

Scope: iconAuthors: soybeanfeView commit206c5

Fix

fix aria-hidden, aria-label, shrink-0 and data-soybean-icon attributes

Scope: iconAuthors: soybeanjsView commitcf042

Feature

optimize icon props

Scope: iconAuthors: soybeanfeView commit206c5

Fix

fix aria-hidden, aria-label, shrink-0 and data-soybean-icon attributes

Scope: iconAuthors: soybeanjsView commitcf042

v0.29.0

2026-06-18

Compare release

Fix

correct import path for useConfigProvider

Scope: iconAuthors: soybeanjsView commit7ad9c

Fix

correct import path for useConfigProvider

Scope: iconAuthors: soybeanjsView commit7ad9c

v0.28.2

2026-05-30

Compare release

Refactor

simplify icon handling and remove Nuxt-specific logic

Scope: iconAuthors: soybeanfeView commit63725

v0.26.0

2026-05-27

Compare release

Fix

update icon prop type to IconValue and enhance Nuxt support

Scope: iconAuthors: soybeanfeView commitb372a

Fix

improve Nuxt icon handling and condition checks

Scope: iconAuthors: soybeanfeView commit8002e

v0.0.20

2026-01-21

Compare release

Docs

update type definition format for IconValue prop

Scope: iconAuthors: soybeanjsView commit58ec2

v0.0.2

2025-11-18

Compare release

Feature

replace lucide-vue-next icons with @iconify/vue in examples and components, and update package dependencies

Scope: iconAuthors: soybeanjsView commit47f24

Feature

introduce Icon component with configurable properties and integration with ConfigProvider for dynamic sizing

Scope: iconAuthors: soybeanjsView commitac117

Fix

add style to prevent icon from shrinking

Scope: iconAuthors: soybeanjsView commit1db8e

Refactor

rename Icon component to SIcon for consistency with naming conventions

Scope: iconAuthors: soybeanjsView commitf05a9

Refactor

remove default color prop for improved icon customization

Scope: iconAuthors: soybeanjsView commit47d42

Refactor

enhance icon component to support IconifyIcon type and improve template logic

Scope: iconAuthors: soybeanjsView commit043aa

Feature

replace lucide-vue-next icons with @iconify/vue in examples and components, and update package dependencies

Scope: iconAuthors: soybeanjsView commit47f24

Feature

introduce Icon component with configurable properties and integration with ConfigProvider for dynamic sizing

Scope: iconAuthors: soybeanjsView commitac117

Fix

add style to prevent icon from shrinking

Scope: iconAuthors: soybeanjsView commit1db8e

Refactor

rename Icon component to SIcon for consistency with naming conventions

Scope: iconAuthors: soybeanjsView commitf05a9

Refactor

remove default color prop for improved icon customization

Scope: iconAuthors: soybeanjsView commit47d42

Refactor

enhance icon component to support IconifyIcon type and improve template logic

Scope: iconAuthors: soybeanjsView commit043aa