# Different ion-split-pane depending on screen size like modern sidemenus with dock state

**URL:** <https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224>\
**Category:** Ionic Framework\
**Created:** [April 8, 2022, 9:06pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224 "2022-04-08T21:06:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![basti](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@basti](https://forum.ionicframework.com/u/basti)\
**Post date:** [April 8, 2022, 9:06pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/1 "2022-04-08T21:06:20Z")

</div>

Hi, I’m using the default `ion-split-pane` from the starter template.  
It’s perfect for small and large screens, but not really good middle screens. Can I show a smaller/thinner `ion-split-pane` on middle screens? Something like ` when="(min-width: 300px) and (max-width: 500px)"`  
So it would be:  
small: burger menu  
middle: thin sidemenu only icon  
large: full sidemenu icon and text

something like this:  
 ![capture_001_08042022_230511](https://global.discourse-cdn.com/ionicframework/original/3X/9/8/98888fbe2fca7eae90d9c8555b29d2a61f09c332.jpeg)

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [April 9, 2022, 9:06am UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/2 "2022-04-09T09:06:55Z")

</div>

Hi

There is a css custom property defining the width. I’d try to use a media query to change this and also to disable the labels in the menu

But haven’t tried it yet

Would be nice to know how though

> **[ion-split-pane | Ionic Documentation](https://ionicframework.com/docs/api/split-pane)**
>
> ion-split-pane: Split Plane View for Menus and Multi-View Layouts

---

<div class="post-metadata">

**Author:** ![jjdev](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jjdev](https://forum.ionicframework.com/u/jjdev)\
**Post date:** [April 10, 2022, 2:22pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/3 "2022-04-10T14:22:35Z")

</div>

I got you @basti  
ive been wondering about this for a while as well

- in addition to what @Tommertom mentioned with split-pane, ionic has a CSS utility class `ion-hide-{breakpoint}-{direction}`  
[CSS Utilities - Element Display](https://ionicframework.com/docs/layout/css-utilities#element-display)

- Use this on the icon and label child elements of the menu links. I had to create 3 instances since it seems you cannot apply an `up` AND `down` utility class to 1 element. to implement the custom width breakpoints, either alter them in the global styles, or use a media query on the specific ion-icons and labels, and adjust the split-pane/menu css

- Finally, add the previously referenced css for the ion-spilt-pane and ion-menu.

You could potentially look at creating a custom component that contains this template/css but aside from that, let me know if this yields the correct results for you or if you find something simpler

app.component.html – modify the `ion-item` as follows:

```auto
<!-- Icon and label for hamburger menu at xs breakpoint -->
<ion-icon class="ion-hide-sm-up" slot="start" [ios]="p.icon + '-outline'" [md]="p.icon + '-sharp'"></ion-icon>
<ion-label class="ion-hide-sm-up">{{ p.title }}</ion-label>

<!-- icon only for sm 'modern' style -->
<ion-icon class="ion-hide-sm-down ion-hide-md-up" [ios]="p.icon + '-outline'" [md]="p.icon + '-sharp'"></ion-icon>

<!-- icon and label again for full size menu -->
<ion-icon class="ion-hide-md-down" slot="start" [ios]="p.icon + '-outline'" [md]="p.icon + '-sharp'"></ion-icon>
<ion-label class="ion-hide-md-down">{{ p.title }}</ion-label>

```

and then in app.component.css add:

```auto
ion-split-pane {
    --side-width: 270px !important;
    --side-max-width: 270px !important;
    ion-menu {
        --width: 270px !important;
        --max-width: 270px !important;
    }
}

@media screen and (max-width: 768px) {
    ion-split-pane {
        --side-width: 68px !important;
        --side-max-width: 68px !important;
        --side-min-width: 68px !important;
        ion-menu {
            --width: 68px !important;
            --max-width: 68px !important;
            --min-width: 68px !important;
        }
    }
}

@media screen and (min-width: 768px) {
    ion-split-pane {
        --side-width: 270px !important;
        --side-max-width: 270px !important;
        ion-menu {
            --width: 270px !important;
            --max-width: 270px !important;
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![basti](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@basti](https://forum.ionicframework.com/u/basti)\
**Post date:** [April 13, 2022, 2:31pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/4 "2022-04-13T14:31:57Z")

</div>

Thanks for your answer! It sounds very great and I copied it, but I think the behaviour ist not like you mentioned it:

![Unbenannt](https://global.discourse-cdn.com/ionicframework/original/3X/6/7/6797a75a55da152df99522a2378ce8f64a4b6fd7.gif)

Or is it the way you thought?

---

<div class="post-metadata">

**Author:** ![jjdev](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jjdev](https://forum.ionicframework.com/u/jjdev)\
**Post date:** [April 14, 2022, 10:38am UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/5 "2022-04-14T10:38:12Z")

</div>

Shoot looks like I missed the minimum breakpoint being the full width, just gotta adjust the css I think

---

<div class="post-metadata">

**Author:** ![basti](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@basti](https://forum.ionicframework.com/u/basti)\
**Post date:** [April 14, 2022, 8:32pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/6 "2022-04-14T20:32:26Z")

</div>

Ok, thanks again, I think I have it so far 😉 :

I had to add `when="(min-width: 576px)"` to the splitpane:  
`<ion-split-pane when="(min-width: 576px)" contentId="main-content">`

and` and (min-width: 576px)` in the css:

```auto
ion-split-pane {
  --side-width: 270px !important;
  --side-max-width: 270px !important;
  ion-menu {
    --width: 270px !important;
    --max-width: 270px !important;
  }
}

@media screen and (min-width: 576px) and (max-width: 992px) {
  ion-split-pane {
    --side-width: 68px !important;
    --side-max-width: 68px !important;
    --side-min-width: 68px !important;
    ion-menu {
      --width: 68px !important;
      --max-width: 68px !important;
      --min-width: 68px !important;
    }
  }
}

@media screen and (min-width: 992px) {
  ion-split-pane {
    --side-width: 270px !important;
    --side-max-width: 270px !important;
    ion-menu {
      --width: 270px !important;
      --max-width: 270px !important;
    }
  }
}

```

Last question:  
In the icon only version, the label is just missing. This has the consequence that the icons are on the same place (left) and on the right remains empty space. Any change to center them? With margin and padding I’d no chance.

---

<div class="post-metadata">

**Author:** ![angelospillos](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@angelospillos](https://forum.ionicframework.com/u/angelospillos)\
**Post date:** [May 4, 2023, 6:26pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/7 "2023-05-04T18:26:29Z")

</div>

Could you provide a stackblitz example with ionic v7?

---

<div class="post-metadata">

**Author:** ![jjdev](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jjdev](https://forum.ionicframework.com/u/jjdev)\
**Post date:** [May 12, 2023, 3:06pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/8 "2023-05-12T15:06:01Z")

</div>

@angelospillos I’ll give it a shot this weekend

---

<div class="post-metadata">

**Author:** ![jjdev](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jjdev](https://forum.ionicframework.com/u/jjdev)\
**Post date:** [May 28, 2023, 6:59pm UTC](https://forum.ionicframework.com/t/different-ion-split-pane-depending-on-screen-size-like-modern-sidemenus-with-dock-state/222224/9 "2023-05-28T18:59:45Z")

</div>

took me a while to find some free time but i think ive got an even more succinct iteration of all this.

- _i used new angular signals_ 🕶
- I know its not 100% but id say its definitely something to get you started
- Ill gladly take any feedback as well if you can max out any improvements  
[angular 16 ionic 7 modern “metro menu”](https://ionic6-angular13-zxxosh.stackblitz.io)

**getting everything set up on stackblitz was kind of tricky** :

- i could not get ionicons to implement correctly, copied all my dependenices so id recommend running it locally, but seems like a stackblitz issue 🤞
- so if anyone has a solution that would be great, seems like there was a problem with ionic 4 and loading in the icons to stackblitz but idk how that compares to now
