Icon
About 326 words
Overview
The <Icon /> component loads icons from different icon libraries based on the markdown.icon configuration.
The theme also provides markdown syntax support. Click to learn more
Configuration
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
markdown: {
icon: { provider: 'iconify' } // Enabled by default
}
})
})interface IconOptions {
/**
* Icon provider
*/
provider: 'iconify' | 'iconfont' | 'fontawesome'
/**
* Default icon prefix. Different providers have different default prefixes
* - iconify - Default: `''`
* - iconfont - Default: `iconfont icon-`
* - fontawesome - Default: `fas`
*/
prefix?: string
/**
* Icon asset links
*/
assets?: IconAssetLink | IconAssetLink[]
size?: string | number
color?: string
}Props
Required
string | { svg: string }Icon name. Supports iconify icon names, icon links (https://… or /…), and inline SVG objects { svg: '<svg>…</svg>' }. When markdown.icon.prefix has a value, the prefix in name can be omitted.
Optional
'iconify' | 'iconfont' | 'fontawesome'Default:Determined by `markdown.icon.provider` (defaults to `'iconify'`)
Icon provider. You can also force a specific provider by using the iconify / iconfont / fontawesome prefix followed by a space in name.
Optional
string | numberDefault:'1em'
Icon size. A number is treated as px, and the 20x20 form is also supported to specify width and height separately.
Optional
stringExtra CSS class name. Fontawesome icons automatically prepend the fa- prefix for class names without it.
Examples
Input:
- home - <Icon name="material-symbols:home" color="currentColor" size="1em" />
- vscode - <Icon name="skill-icons:vscode-dark" size="2em" />
- twitter - <Icon name="skill-icons:twitter" size="2em" />Output:
- home -
- vscode -
- twitter -
Contributors
Changelog
e4dae-docs: improve docs (#1071)on7a454-feat(plugin-md-power): dropoptionaltag infieldcontainer (#987)on1d04d-feat: add builtin auto-import-components (#932)on16c2d-docs: update field containeron38505-docs: update en docs (#708)on4d236-feat(theme)!: add collections support (#704)on14973-feat: add multiple provider support for icon, close #568 (#596)ond1496-docs: update docson0fd6c-refactor(theme): improve types and flat config (#524)one3b1c-docs: improve docson
