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.
Much appreciate the reply!
– Jae Barclay Aug 03 '22 at 12:37