Icons
Icons are resolved when you build, not when a reader loads the page. DocsLit looks each icon up in two bundled libraries, Lucide and Font Awesome Free 6, and writes the SVG straight into the page. There is no CDN request at view time, no flash of missing icons, and every icon works in an offline build opened from disk.
Ways to write an icon
The same value works in wc-icon and in the icon attribute of every component that has one.
| You write | You get | Example |
|---|---|---|
| A bare name | The Lucide or Font Awesome icon with that name | rocket |
| Font Awesome classes | A specific Font Awesome style | fa-solid fa-gear, fa-regular fa-star, fa-brands fa-github |
| A library prefix | A specific library | lucide:zap, fa:zap |
| An emoji | The emoji as text | 🚀 |
| An image path or URL | The image, for example an SVG or PNG | img/mark.svg, https://example.com/logo.svg |
Inline <svg> |
Your own SVG, with scripts and event handlers removed | <svg viewBox="0 0 24 24">…</svg> |
Image icons are sized to the icon box of the component, or to size on wc-icon, so an SVG or PNG fits wherever a named icon would.
Here they are, live:
rocket · github · fa-solid fa-gear · fa-regular fa-star · fa-brands fa-docker · lucide:zap · 🚀
Font Awesome names and styles
Font Awesome icons are in three styles: solid, regular and brands. A bare name picks the first style that has it, and brand names such as github and docker find the brands set. To choose a style, use classes (fa-regular fa-star, or the short forms fas, far and fab), or set icon-type next to a bare name:
Pro-only styles (fa-light, fa-thin, fa-duotone, fa-sharp) are not bundled, and they fall back to the free solid icon of the same name. Size and animation classes such as fa-lg and fa-spin are ignored. Use size and color instead.
Choose which library wins
A bare name can exist in both libraries. The icons.library setting in docslit.json decides which one is tried first:
library |
Bare names are looked up |
|---|---|
auto (default) |
The original DocsLit names (check, x, info, search, star, zap, book, settings and 25 more) in Lucide first, so existing sites look the same. Every other name in Font Awesome first, then Lucide. |
fontawesome |
In Font Awesome first, then Lucide. |
lucide |
In Lucide first, then Font Awesome. |
A prefix or Font Awesome classes always override the setting. The importer writes fontawesome for Mintlify sites that use it.
Where you can use icons
- Components:
wc-icon,wc-callout,wc-banner,wc-badge,wc-accordion,wc-expandable,wc-card,wc-tile,wc-button(iconandright-icon),wc-tab,wc-view-panel,wc-step,wc-prompt,wc-paneland code blocks (icon=). - Navigation: sidebar groups and pages, tabs and anchors, navbar links and buttons, and custom contextual menu options.
- Frontmatter: the
iconkey, which sets the sidebar icon of the page.
Components take an icon-type attribute (solid, regular or brands) for bare Font Awesome names.
icon-name is the older spelling of icon on wc-card and wc-tile. It still works.
Check your icons
An icon name that exists in neither library renders nothing. docslit validate reports it as unknown-icon with a line number and the nearest known name, so a typo does not slip through:
Browse the available names in the Lucide and Font Awesome Free catalogs. DocsLit bundles Lucide 1.60 and Font Awesome Free 6.7.2. Tabler icons are not bundled, but a Tabler name that also exists in Lucide or Font Awesome still resolves.
wc-icon attributes
src: a bare name, Font Awesome classes, lucide:name, an emoji, an image path or URL, or inline <svg>.solid, regular or brands.name, so name is not needed when you set it, as in <wc-icon src="img/mark.svg"></wc-icon>.Licenses
Lucide is ISC licensed. Font Awesome Free icons are CC BY 4.0, and the attribution is in the NOTICES file shipped with the docslit package.
Next steps
- Use icons in cards and tiles and tabs and accordions
- Add icons to the sidebar and tabs in Pages and navigation