Reputation: 2045
I have left and right ionic side menu, which i want to change both the menu width. I have successfully change the left menu width as shown below but i am not sure how to change the right menu width. Currently, the left menu width change but when right menu is being toggle, the right menu content is distorted.
.menu.menu-left{
width: calc(100% - 70px) !important;
}
.menu-open .menu-content{
transform: translate3d(calc(100% - 70px), 0px, 0px) !important;
}
Upvotes: 4
Views: 9391
Reputation: 1096
Put it inside :root on variables.scss
e.g.
<ion-menu menuId="mainMenu" class="mainMenu">
...
</ion-menu>
and set it like
:root {
.mainMenu {
--width: 100vw;
}
or
ion-menu {
--width: 100vw;
}
}
Upvotes: 0
Reputation: 8351
For Ionic5 and above projects, we can overwrite the side panel's CSS like below to make it customized as per requirements.
ion-split-pane {
--side-max-width: 18%;
--side-min-width: 270px;
}
Put this class where you implemented your menu so it will overwrite existing CSS with this.
Upvotes: 1
Reputation: 1122
As people gave their answer I wish to give it mine too.
PX is good but if we add width in percentage then its works with every device. add this scss on your page.scss file
ion-menu {
--width: 83%;
}
And the HTML does not need to give a class name or anything, you can give it if you want.
<ion-menu contentId="main-content" type="overlay"></ion-menu>
Upvotes: 0
Reputation: 308
Use a class name to change the width of the side menu.
<ion-menu class="custom" side="end" menuId="first">
</ion-menu>
In CSS you can use like below.
.custom {
--width: 500px;
}
Upvotes: 3
Reputation: 2557
Just add the "menu-width" in variables.scss
$menu-width: 200px;
Upvotes: 5
Reputation: 2740
According to this just add width
attribute in ion-side-menu
element.
Ionic docs for sidemenu is here
<ion-side-menu
side="left"
width="500">
</ion-side-menu>
Upvotes: 0