Selbin C R
Selbin C R

Reputation: 41

How to change width of a sidebar in 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

Upvotes: 4

Views: 1989

Answers (1)

Joseph Carey
Joseph Carey

Reputation: 126

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;
}

Upvotes: 8

Related Questions