网页 综合 更新时间 2026-11-16 04:29:50

Usage · @nuxt/icon · Nuxt Modules

自动蜘蛛 nuxt.com 正文约 1598 字
Usage · @nuxt/icon · Nuxt Modules
When using an icon from Iconify, a <span> or <svg> will be created based on the rendering mode, you can give all the attributes of the native element.
When using TailwindCSS v4 with the css mode, you should configure the cssLayer in Nuxt's app config:
You can use any name from the https://icones.js.org collection:
It supports the i- prefix (for example, i-uil-github).
It's highly recommended to install the icon data locally with
For example, to use the uil:github icon, install its collection with @iconify-json/uil. This way the icons can be served locally or from your serverless functions, which is faster and more reliable on both SSR and client-side.
You may also know you can install @iconify/json package to include all iconify icons. This is not recommended because it will increase your server bundle size and building performance. If you choose to do so, we'd recommend to explicitly specify the collection names you need:
When the name matches a global registered component, it will be rendered as that component (in this case mode will be ignored):
Note that MyComponent needs to be inside components/global/ folder (see example).
You can also change the component name with:
You can use the Icon component in a render function (useful if you create a functional component), for this you can import it from #components:
See an example of a <MyIcon> component:
Add 200,000+ ready to use icons to your Nuxt application.
Every option of the icon key in your Nuxt config.
Stay updated on new releases and features, guides, and community updates.
Copyright © 2016-2026 Nuxt - MIT License
访问原文 返回搜索 https://nuxt.com/modules/icon/usage
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。