Skip to content

Commit

Permalink
feat: add iconify API configuration option (#111)
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
  • Loading branch information
ace-of-aces and atinux authored Oct 25, 2023
1 parent 8a93020 commit e7dce2d
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 351 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@ The icons will have the default size of `24px` and the `nuxt` icon will be avail
<Icon name="nuxt" />
```

By default, this module will fetch the Icons from [the official Iconify API](https://api.iconify.design). You can change this behavior by setting the `nuxtIcon.iconifyApiOptions.url` property to [your own Iconify API](https://iconify.design/docs/api/hosting.html).

You can also set `nuxtIcon.iconifyApiOptions.publicApiFallback` to `true` to use the public API as a fallback (only for the `<Icon>` component, not for the `<IconCSS>` component`)

```ts
// app.config.ts
export default defineAppConfig({
nuxtIcon: {
// ...
iconifyApiOptions: {
url: 'https://<your-api-url>',
publicApiFallback: true // default: false
}
}
})
```

## Render Function

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`:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@nuxt/kit": "^3.8.0"
},
"devDependencies": {
"@nuxt/devtools": "^0.8.5",
"@nuxt/devtools": "^1.0.0",
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/module-builder": "latest",
"@types/node": "^20.8.8",
Expand Down
Loading

0 comments on commit e7dce2d

Please sign in to comment.