Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make ant-design Drawer component width responsive

Tags:

reactjs

antd

I'm using ant design drawer component and style component. It seems the I can set a fixed width with width props. ButI can't make it responsive.

<Drawer
   width={500}
   placement="right"
   closable={true}
   onClose={this.props.handleDrawer}
   visible={this.props.visible}
>
like image 588
Mohib Avatar asked Mar 06 '23 08:03

Mohib


1 Answers

In my case this one-liner would be the simplest solution:

width={window.innerWidth > 900 ? 800 : window.innerWidth - 100}

like image 139
jouta helm Avatar answered Apr 01 '23 23:04

jouta helm