Resizable Sidebar #9676
Replies: 1 comment
-
|
I think the cleanest way to achieve a resizable sidebar in Docusaurus is to wrap the sidebar and main layout in a split-pane style container and then control the sidebar width via React state. A simple approach is:
If you're using swizzling, you can override A minimal idea looks like:
Libraries like If you want behavior similar to the CodeSandbox you linked, using a library is usually the most stable option because it handles edge cases like selection dragging, touch support, and window resize automatically. If this answer helped or pointed you in the right direction, I'd appreciate it if you could mark it as the accepted answer so it's easier for others with the same issue to find. Also, if you found my contribution useful, I'd appreciate it if you could check out my GitHub profile, follow me, and star any repositories you find interesting. GitHub: https://github.com/Advait251206 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am hoping to make my sidebar resizable by having a divider that the user can drag to make the sidebar larger or smaller. Are there any ideas on ways to swizzle and create this?
I am hoping for a sidebar like the one in this sandbox: https://codesandbox.io/p/sandbox/react-resizable-sidebar-kz9de?file=%2Fsrc%2Findex.js%3A8%2C15
Beta Was this translation helpful? Give feedback.
All reactions