Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide sidebar fully in ant design

Tags:

antd

Is there anyway to hide ant design sidebar fully on onCollapse method? One way is to set it's display to none, But I don't want that coz I want the same animation that onCollapse method provides by default.

like image 867
prisoner_of_azkaban Avatar asked Sep 15 '17 09:09

prisoner_of_azkaban


2 Answers

As mentioned in the "Responsive" example you can set <Layout.Sider collapsedWidth={0} />, which will completely hide it.

By default this causes a trigger button with a hamburger icon to appear, but you can turn it off by adding trigger={null}.

like image 140
Jesper We Avatar answered Oct 13 '22 13:10

Jesper We


Antd uses breakpoints similar to bootstrap, their idea is Mobile first, which means, you should think in mobile first. It means, you should not design your web app for desktop and then try to hide/adjust when it's in smaller view. Instead, you should, design it for mobile view and then adjust to desktop view.

ultimately, what I want to say is, set the sidebar default state as display:none and then use grid break points such as <Col md={2} />

you can see this question for more details antd hide on smaller view

like image 42
Yichaoz Avatar answered Oct 13 '22 12:10

Yichaoz