I want to add icon sidebar group or item with docusaurus. How can I do it?
Like:
customCss to your theme config(docs), e.g.:
{
// ...
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
// ...
theme: {
customCss: require.resolve('./src/css/custom.css'),
}
})
]
]
}
./src/css/custom.css:
/* Override non-category links to be horizonally compact */
li > a.menu__link {
justify-content: flex-start;
}
sidebar_class_name: item1 to front matter of the item's sidebar link.
item1's sidebar li element..item1 a::before {
padding-right: 0.5rem;
content: url(../img/myImage.svg);
}
"className": "section1" to _category_.jsonmy-section-class::before, but add transform to move it off to the right and center it vertically with a bit of fiddly-diddling.In this example, Installation has no icon, while Item1 does: