Utilisation
Utilisez le prop name pour afficher une icône.
<template>
<UIcon name="i-lucide-lightbulb" class="size-5" />
</template>Parcourez-les facilement sur https://icones.js.org ou recherchez directement à partir de votre assistant AI à l'aide de l'outil MCP
search-icons.Il est fortement recommandé d'installer les collections d'icônes dont vous avez besoin, en savoir plus à ce sujet.
Exemples
SVG
Vous pouvez également passer un composant Vue dans le prop name:
<script setup lang="ts">
import { h } from 'vue'
const IconLightbulb = () => h(
'svg',
{ xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24' },
[
h(
'path',
{
'fill': 'none',
'stroke': 'currentColor',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 2,
'd': 'M15 14c.2-1 .7-1.7 1.5-2.5c1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5c.7.7 1.3 1.5 1.5 2.5m0 4h6m-5 4h4'
}
)
]
)
</script>
<template>
<UIcon :name="IconLightbulb" class="size-5" />
</template>
Vous pouvez définir vos composants d'icônes vous-même, ou utiliser unplugin-icons pour les importer directement à partir de fichiers SVG:
<script setup lang="ts">
import IconLightbulb from '~icons/lucide/lightbulb'
</script>
<template>
<UIcon :name="IconLightbulb" class="size-5" />
</template>
api
Props
| Prop | Default | Type |
|---|---|---|
name | any | |
mode | "svg" | "css" | |
size | string | number | |
customize | boolean | IconifyIconCustomizeCallback | null |
Changelog
No recent changes