Configuration

Every option of the icon key in your Nuxt config.

Configure Nuxt Icon with the icon key in your nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxt/icon'],
  icon: {
    mode: 'css',
    cssLayer: 'base'
  }
})

Options

OptionDefaultDescription
sizeundefinedIcon Size — Set the default icon size.
class''CSS Class — Set the default CSS class.
mode'css'Default Rendering Mode — Set the default rendering mode for the icon component
aliases{}Icon aliases — Define Icon aliases to update them easily without code changes.
cssSelectorPrefix'i-'CSS Selector Prefix — Set the default CSS selector prefix.
cssLayerundefinedCSS Layer Name — Set the default CSS @layer name.
cssWherePseudotrueUse CSS :where() Pseudo Selector — Use CSS :where() pseudo selector to reduce specificity.
collectionsnullIcon Collections — List of known icon collections name. Used to resolve collection name ambiguity. e.g. simple-icons-github -> simple-icons:github instead of simple:icons-github When not provided, will use the full Iconify collection list.
customCollectionsundefinedCustom Icon Collections — Local SVG directories or Iconify JSON collections to serve, see Custom Collections.
providerundefinedIcon Provider — Provider to use for fetching icons - server - Fetch icons with a server handler - iconify - Fetch icons with Iconify API, purely client-side - none - Do not fetch icons (use client bundle only) server by default; iconify when ssr: false Use { server, client } to set a different provider for SSR and for the browser, e.g. { server: 'server', client: 'iconify' }. A string is the same as setting both sides. Both server and client are required in the object form.
iconifyApiEndpoint'https://api.iconify.design'Iconify API Endpoint URL — Define a custom Iconify API endpoint URL. Useful if you want to use a self-hosted Iconify API. Learn more: https://iconify.design/docs/api.
fallbackToApitrueFallback to Iconify API — Fallback to Iconify API if server provider fails to found the collection.
localApiEndpoint'/api/_nuxt_icon'Local API Endpoint Path — Define a custom path for the local API endpoint.
fetchTimeout1500Fetch Timeout — Set the timeout for fetching icons.
customize is the only option you can't set in nuxt.config.ts: it's a function, so set it in app.config.ts or with the component's customize prop. See Icon Customization.