<p>There's no built-in way to do this, but you can build that functionality into a module. This will inject some CSS to all CP requests that will remove the sidebar and make the page container span the entire page:</p>
<pre class="lang-php prettyprint-override"><code>/** @var craft\web\View $view */
$view = Craft::$app-&gt;getView();

if (Craft::$app-&gt;getRequest()-&gt;getIsCpRequest()) {
    $view-&gt;registerCss(&lt;&lt;&lt;'CSS'
        #global-sidebar {
            display: none;
        }
        body.ltr #page-container {
            padding-left: 0;
        }
        #main-content {
            width: 100vw;
        }
    CSS);
}
</code></pre>
<p>(Will need some adjustments if you need to support <code>rtl</code> languages.)</p>
<p>Now this alone is not particularly useful, but you can make it more dynamic depending on your requirements:</p>
<ul>
<li>To limit this to particular user groups, you can use the <a href="https://plugins.craftcms.com/cp-body-classes" rel="nofollow noreferrer"><strong>Control Panel Body Classes</strong> plugin</a> and scope the CSS to a particular user group class.</li>
<li>If you want to have an on/off toggle, you can inject some JavaScript (<a href="https://www.yiiframework.com/doc/api/2.0/yii-web-view#registerJs()-detail" rel="nofollow noreferrer">see <code>View::registerJs</code></a>) that adds a floating button to toggle the above CSS on click.</li>
</ul>

CC BY-SA 4.0
2022-08-03T12:37:18.957Z
That sounds good. I think I can get away with injecting CSS or simply using the plugin you suggested.

Much appreciate the reply!
Jae Barclay
CC BY-SA 4.0
2022-08-03T12:49:35.493Z
@JaeBarclay If this solved your issue, would you mind marking my answer as accepted? Thanks.
MoritzLost
CC BY-SA 4.0
2022-08-03T07:48:47.820Z
2022-08-03T07:48:47.820Z
MoritzLost
<p>Is there a way to toggle the left/sidebar admin menu altogether, like VSCode or SublimeText?</p>
<p>It'd be great to only display the sections &amp; entries on certain occasions. This comes in handy especially if there are several columns selected in a particular section.</p>
<p>Thanks in advance!</p>

<admin>
Hiding the left admin menu?
# Hiding the left admin menu?

(Asked by: username_0 on 2022-08-03)

Is there a way to toggle the left/sidebar admin menu altogether, like VSCode or SublimeText?

It'd be great to only display the sections & entries on certain occasions. This comes in handy especially if there are several columns selected in a particular section.

Thanks in advance!

**Tags:** admin


---

## 1 answers

### Answer by username_1 on 2022-08-03. Score: 3 | Accepted answer

There's no built-in way to do this, but you can build that functionality into a module. This will inject some CSS to all CP requests that will remove the sidebar and make the page container span the entire page:
/** @var craft\web\View $view */
$view = Craft::$app->getView();

if (Craft::$app->getRequest()->getIsCpRequest()) {
    $view->registerCss(<<<'CSS'
        #global-sidebar {
            display: none;
        }
        body.ltr #page-container {
            padding-left: 0;
        }
        #main-content {
            width: 100vw;
        }
    CSS);
}

(Will need some adjustments if you need to support rtl languages.)
Now this alone is not particularly useful, but you can make it more dynamic depending on your requirements:

To limit this to particular user groups, you can use the Control Panel Body Classes plugin and scope the CSS to a particular user group class.
If you want to have an on/off toggle, you can inject some JavaScript (see View::registerJs) that adds a floating button to toggle the above CSS on click.

> **Comments:**
> **username_0**: That sounds good. I think I can get away with injecting CSS or simply using the plugin you suggested.  Much appreciate the reply!  
> **username_1**: @JaeBarclay If this solved your issue, would you mind marking my answer as accepted? Thanks.  

---

