This is a guide, not the contract. What the platform guarantees is specified under
openspec/specs/. For this page:shell-layout·host-services. Where this page and a specification disagree, the specification is right, and that is a defect in this page: change the behaviour there, then explain it here.
Collapse, resize, hide and show, by the region ids you declared and the view ids you registered.
const sidebars = inject(SidebarService);
sidebars.collapse('left-panel'); sidebars.expand('left-panel'); sidebars.toggle('left-panel');
sidebars.setWidth('left-panel', 320); // clamped to the usable range, remembered like a released drag
sidebars.hideView('acme.outline'); // asks about unsaved work exactly as the view menu does
sidebars.showView('acme.outline'); // back where it was declared, or in the region you namesidebars.regions(); // SidebarFacts[]: regionId, collapsed, width, per declared panel
sidebars.isCollapsed('left-panel'); // reactive where it is read
sidebars.width('left-panel');
sidebars.hiddenViews(); // readonly string[]: the ids of the hidden viewsregions() lists every declared panel as SidebarFacts: regionId, collapsed, width. hiddenViews() lists the ids of hidden views. isCollapsed(regionId) and width(regionId) read the same signals and are reactive where they are called.
hideView asks exactly as the view menu does, for the surfaces the view holds. Collapsing, resizing and showing ask nothing.
sidebar.collapse, sidebar.resize and sidebar.hideViews take the header control, the splitter and the menu entry away from the user; every action here keeps working for you.
Unknown ids. A region id that no declared panel carries does nothing.
Same code as the controls. Every action is the one the sidebar header, the splitter and the view menu run, with the guard named above. The switches do not reach the service, as Switched off says.
- Layout: regions and docks: declaring the panels.
- Shell anatomy: the region vocabulary.