Please add the ability to customize sidebar elements. Use react components as sidebarItem elements. Thanks in advance
P
Pierre Wizla
Hi!
I'm not maintaining Docusaurus, I'm just an advanced user wanting to share my experience.
Unless I misunderstood your suggestion, you can already customize sidebar elements through "swizzling" : https://docusaurus.io/docs/swizzling.
All parts of the Docusarus UI already are React components.
The only drawback for now is that DocSidebarItem is marked as "Unsafe" when you swizzle, which means you will have to maintain the code yourself and it might break in an upcoming major version of Docusaurus (v4).
I did it for Strapi docs. I ejected the current code, and we're passing
customProps
(https://docusaurus.io/docs/sidebar#passing-custom-props) to sidebar items to be able to add "New" or "Updated" badges to the sidebar.See code here : https://github.com/strapi/documentation/blob/main/docusaurus/src/theme/DocSidebarItem/Category/index.js and see it in action there: https://docs.strapi.io/dev-docs/intro