Bootstrap Icons meets Nuxt
Documentation
:-P An easier way of using bootstrap-icons for your Nuxt project!
Setup
Run the following command to install and add the module to your project:
$ pnpm dlx nuxi@latest module add nuxt-bootstrap-icons
Aside #1: I know I'm being preferential in my choice of package managers.
Aside #2: This module supports any case for the component name.
Congratulations ๐, you can now browse bootstrap-icons for icons to use in your project!
Configuration
You can configure the module using the bootstrapIcons
key in your nuxt.config
Options
display
- Default:
inline
- Description: How should the module register the icons?
- Type:
String
export default defineNuxtConfig({
bootstrapIcons: {
display: "inline", // or 'component'
},
});
Note: When using inline
, the module will register a component (depending on your prefix)
<BootstrapIcon name="0-circle" />
Note: When using component
, the module will register all icons from bootstrap-icons as components (including the prefix)
<BootstrapIcon0Circle />
prefix
- Default:
bootstrap-icon
- Description: What should be prefixed to the icons?
- Type:
String
export default defineNuxtConfig({
bootstrapIcons: {
prefix: "your-prefix",
},
});
Tip: if you have a multi word prefix, you should include a โ between the words.
showList
- Default:
false
- Description: Option: enable to add a virtual JSON file containing all the icons registered at path
#build/nuxt-bootstrap-icons.json
- Type:
Boolean
export default defineNuxtConfig({
bootstrapIcons: {
showList: true,
},
});