Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change width of a sidebar in docusaurus

Tags:

docusaurus

I want to change the sidebar width in docusaurus, I am only allowed to change the width of sidebar in a particular page.Can anyone suggest me a solution

like image 756
Selbin C R Avatar asked Nov 01 '25 18:11

Selbin C R


1 Answers

In version ~2.0.0 you can create your own CSS files (/src/css/custom.css) by defining it in the docusaurus.config.js. There you can set your override styles. When inspecting the page, there's Docusaurus sets the variable for --doc-sidebar-width: 300px; I was able to override that variable with an !important:

:root { 
    --doc-sidebar-width: 250px !important;
}
like image 80
Joseph Carey Avatar answered Nov 04 '25 12:11

Joseph Carey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!