# Layout anatomy

The **layout anatomy** describes the building blocks, areas and spacing of a page.

## Usage

### Building blocks

![Layout anatomy](<../images/layout-anatomy.png>)

- **[Application header](<https://element.siemens.io/components/layout-navigation/application-header/>):** Is present in all screens. It can be used as the primary navigation and it contains system items such as user information, notifications, and more.
- **Vertical navigation:** It can be used as primary or secondary navigation with from top to bottom on the left side of a screen.
- **Main area:** Central area of the interface. Note, depending on the use case, the `side panel` may or may not belong to the `main area`.
- **Status area:** Designated for status-related elements, such as status bar or inline notifications.
- **Breadcrumb area:** Reserved for navigational aids like breadcrumbs.
- **[Page header](<https://element.siemens.io/fundamentals/layouts/header/>):** It organizes elements that provide context to the current page, such as the title, description, and page-specific actions.
- **Toolbar area:** This flexible area may contain tools that alter the page's content, including search functions, filters, or additional actions.
- **[Content](<https://element.siemens.io/fundamentals/layouts/content/>):** Specific content of the page.
- **Side panel:** Displays additional content or functionality that is related to the main content of a page and is specifically tailored to the current context or task.

Each of these elements is **optional**, with the exception of the horizontal navigation which is a mandatory feature. Only use elements that are really needed. E.g. a vertical navigation with only one item does not make sense.

### Horizontal spacing

![Layout horizontal spacing](<../images/layout-horizontal-spacing.png>)

Note, you should not use absolute pixel values for spacing. Element provides a [grid system](<https://element.siemens.io/fundamentals/layouts/grid/>) and many helper classes to set the corrected spacings.

## Code

Element provides components and CSS layout classes to support building a page.

- `.si-layout-main-padding` sets the padding of the main content
- `.si-layout-status` should be used for status information as the `<si-inline-notification>` or the `<si-status-bar>`
- `.si-layout-breadcrumb` should be used in combination with `si-breadcrumb`
- `.si-layout-header` and related CSS classes are documented at [Header](<https://element.siemens.io/fundamentals/layouts/header/>)
- `.si-layout-top-element` marks the top element in the main area and adds extra space in the mobile viewport for the vertical navigation and the side panel.

If you have a toolbar, add 16px bottom margin to the content e.g. by adding the utility class `.mb-6`.

The CSS classes are responsive and will automatically reserve space for the vertical-navbar and the side-panel.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';
import { SiAccordionComponent, SiCollapsiblePanelComponent } from '@siemens/element-ng/accordion';
import {
  App,
  AppCategory,
  SiAccountDetailsComponent,
  SiApplicationHeaderComponent,
  SiHeaderAccountItemComponent,
  SiHeaderActionItemComponent,
  SiHeaderActionsDirective,
  SiHeaderBrandDirective,
  SiHeaderCollapsibleActionsComponent,
  SiHeaderLogoDirective,
  SiLaunchpadFactoryComponent
} from '@siemens/element-ng/application-header';
import { BreadcrumbItem, SiBreadcrumbComponent } from '@siemens/element-ng/breadcrumb';
import {
  ContentActionBarMainItem,
  SiContentActionBarComponent
} from '@siemens/element-ng/content-action-bar';
import {
  SiHeaderDropdownComponent,
  SiHeaderDropdownItemComponent,
  SiHeaderDropdownTriggerDirective
} from '@siemens/element-ng/header-dropdown';
import { MenuItem } from '@siemens/element-ng/menu';
import { NavbarVerticalItem, SiNavbarVerticalComponent } from '@siemens/element-ng/navbar-vertical';
import { SiSearchBarComponent } from '@siemens/element-ng/search-bar';
import { SiSidePanelComponent, SiSidePanelContentComponent } from '@siemens/element-ng/side-panel';
import { SiStatusBarComponent, StatusBarItem } from '@siemens/element-ng/status-bar';
import { SiSystemBannerComponent } from '@siemens/element-ng/system-banner';

@Component({
  selector: 'app-sample',
  imports: [
    RouterLink,
    SiAccordionComponent,
    SiAccountDetailsComponent,
    SiApplicationHeaderComponent,
    SiBreadcrumbComponent,
    SiCollapsiblePanelComponent,
    SiContentActionBarComponent,
    SiHeaderAccountItemComponent,
    SiHeaderActionItemComponent,
    SiHeaderActionsDirective,
    SiHeaderBrandDirective,
    SiHeaderCollapsibleActionsComponent,
    SiHeaderDropdownComponent,
    SiHeaderDropdownItemComponent,
    SiHeaderDropdownTriggerDirective,
    SiLaunchpadFactoryComponent,
    SiNavbarVerticalComponent,
    SiSearchBarComponent,
    SiSidePanelComponent,
    SiSidePanelContentComponent,
    SiStatusBarComponent,
    SiSystemBannerComponent,
    SiHeaderLogoDirective
  ],
  templateUrl: './anatomy.html'
})
export class SampleComponent {
  breadcrumbItems: BreadcrumbItem[] = [
    { title: 'Root', link: 'root' },
    { title: 'Level 1', link: ['root', 'level1'] },
    { title: 'Level 2', link: ['root', 'level1', 'level2'] }
  ];

  statusItems: StatusBarItem[] = [
    { title: 'Security', status: 'danger', value: 4 },
    { title: 'Update', status: 'warning', value: 14 },
    { title: 'Information', status: 'info', value: 37 }
  ];

  verticalNavbarItems: NavbarVerticalItem[] = [
    {
      type: 'group',
      label: 'Home',
      icon: 'element-home',
      children: [
        {
          type: 'router-link',
          label: 'Sub Item',
          routerLink: 'subItem',
          badge: 4,
          badgeColor: 'warning'
        },
        {
          type: 'router-link',
          label: 'Sub Item 2',
          routerLink: 'subItem2'
        },
        {
          type: 'router-link',
          label: 'Sub Item 3',
          routerLink: 'subItem3'
        }
      ]
    },
    {
      type: 'group',
      label: 'Documentation',
      icon: 'element-document',
      children: [
        {
          type: 'router-link',
          label: 'Sub Item 4',
          routerLink: 'subItem4'
        },
        {
          type: 'router-link',
          label: 'Sub Item 5',
          routerLink: 'subItem5'
        },
        {
          type: 'router-link',
          label: 'Sub Item 6',
          routerLink: 'subItem6'
        }
      ]
    },
    {
      type: 'router-link',
      label: 'Energy & Sustainability',
      icon: 'element-trend',
      routerLink: 'energy'
    },
    {
      type: 'router-link',
      label: 'Test Coverage',
      icon: 'element-diagnostic',
      routerLink: 'coverage'
    }
  ];

  primaryActions: ContentActionBarMainItem[] = [
    {
      type: 'action',
      label: 'Print',
      icon: 'element-print',
      action: () => alert('Print')
    },
    {
      type: 'action',
      label: 'Share',
      icon: 'element-share',
      action: () => alert('Share')
    },
    {
      type: 'group',
      label: 'Save As',
      icon: 'element-save',
      children: [
        {
          type: 'action',
          label: 'Save as New Trend',
          action: () => alert('Save as New Trend')
        },
        {
          type: 'action',
          label: 'Save as a Copy',
          action: () => alert('Save as a Copy')
        },
        {
          type: 'action',
          label: 'Save as a Template',
          action: () => alert('Save as a Template')
        }
      ]
    }
  ];

  secondaryActions: MenuItem[] = [
    {
      type: 'group',
      label: 'Download as',
      icon: 'element-download',
      children: [
        {
          type: 'action',
          label: 'Image',
          action: () => alert('Image')
        },
        {
          type: 'action',
          label: 'File',
          action: () => alert('File')
        }
      ]
    },
    {
      type: 'action',
      label: 'Copy',
      icon: 'element-copy',
      action: () => alert('Copy')
    },
    {
      type: 'action',
      label: 'Hide',
      icon: 'element-hide',
      action: () => alert('Hide')
    },
    {
      type: 'action',
      label: 'Export',
      icon: 'element-export',
      action: () => alert('Export')
    },
    {
      type: 'action',
      label: 'Favorite',
      icon: 'element-favorite',
      action: () => alert('Favorite')
    }
  ];

  categories: AppCategory[] = [
    {
      name: 'All apps',
      apps: [
        {
          name: 'Assets',
          iconUrl: './assets/app-icons/assets.svg',
          href: '.'
        },
        {
          name: 'Fischbach',
          iconUrl: './assets/app-icons/fischbach.svg',
          favorite: true,
          href: '.'
        },
        {
          name: 'Rocket',
          iconUrl: './assets/app-icons/rocket.svg',
          href: '.'
        },
        {
          name: 'Statistics',
          iconUrl: './assets/app-icons/statistics.svg',
          href: '.'
        }
      ]
    }
  ];

  updateFavorite({ app, favorite }: { app: App; favorite: boolean }): void {
    app.favorite = favorite;
    this.categories = [...this.categories];
  }
}
```

Template:

```html
<div class="has-navbar-fixed-top has-system-banner si-layout-fixed-height h-100">
  <si-system-banner
    class="fixed-top"
    message="System maintenance scheduled for 2 AM - 4 AM UTC"
    status="info"
  />
  <si-application-header [launchpad]="launchpad">
    <si-header-brand>
      <a siHeaderLogo routerLink="/"></a>
      <h1 class="application-name">Application name</h1>
    </si-header-brand>

    <si-header-actions>
      <si-header-collapsible-actions>
        <button
          si-header-action-item
          type="button"
          icon="element-help"
          [siHeaderDropdownTriggerFor]="support"
          >Support</button
        >
        <button si-header-action-item type="button" icon="element-settings" [badge]="true"
          >Settings</button
        >
      </si-header-collapsible-actions>

      <button
        si-header-account-item
        type="button"
        name="Lars Vegas"
        [siHeaderDropdownTriggerFor]="account"
      >
      </button>
    </si-header-actions>
  </si-application-header>

  <si-navbar-vertical
    navbarCollapseButtonText="collapse"
    navbarExpandButtonText="expand"
    [items]="verticalNavbarItems"
  >
    <si-side-panel mode="scroll" [collapsible]="true">
      <div class="si-layout-main-padding si-layout-fixed-height">
        <si-status-bar class="si-layout-status si-layout-top-element" blink [items]="statusItems" />
        <si-breadcrumb class="si-layout-breadcrumb" [items]="breadcrumbItems" />
        <div class="si-layout-header">
          <h2 class="si-layout-title">Title describing what page content to expect</h2>
          <p class="si-layout-subtitle">Lorem ipsum dolor sit amet, ...</p>

          <si-content-action-bar
            class="si-layout-actions"
            viewType="expanded"
            [primaryActions]="primaryActions"
            [secondaryActions]="secondaryActions"
          />
        </div>

        <div class="mb-6">
          <div class="row gy-6">
            <si-search-bar placeholder="Search" class="col-12 col-md" [showIcon]="true" />
            <div class="col-auto">
              <button type="button" class="btn btn-secondary">Toolbar item</button>
            </div>
          </div>
        </div>

        <div class="border rounded-2 si-layout-fixed-height p-4 mb-5"
          >Placeholder for the content of the page, using the fixed height layout.</div
        >
      </div>

      <si-side-panel-content heading="Cooling coil" displayMode="overlay" [searchable]="true">
        <si-accordion [fullHeight]="true">
          <si-collapsible-panel
            heading="Properties"
            icon="element-settings"
            contentCssClasses="p-6"
          >
            And here we have some content
          </si-collapsible-panel>
          <si-collapsible-panel heading="Documents" icon="element-document" contentCssClasses="p-6">
            And this is the content
          </si-collapsible-panel>
          <si-collapsible-panel heading="Graphics" icon="element-image" contentCssClasses="p-6">
            Nothing to see here
          </si-collapsible-panel>
        </si-accordion>
      </si-side-panel-content>
    </si-side-panel>
  </si-navbar-vertical>
</div>

<ng-template #launchpad>
  <si-launchpad-factory
    enableFavorites
    [apps]="categories"
    (favoriteChange)="updateFavorite($event)"
  />
</ng-template>

<ng-template #support>
  <si-header-dropdown>
    <button si-header-dropdown-item type="button">Help</button>
    <button si-header-dropdown-item type="button">Contact</button>
  </si-header-dropdown>
</ng-template>

<ng-template #account>
  <si-header-dropdown>
    <si-account-details
      name="Lars Vegas"
      email="lars.vegas@siemens.com"
      company="Siemens AG"
      userRole="Admin"
    />
    <div class="dropdown-divider"></div>
    <button
      si-header-dropdown-item
      icon="element-language"
      type="button"
      [siHeaderDropdownTriggerFor]="language"
    >
      Language
    </button>
    <button si-header-dropdown-item icon="element-palette" type="button">Design</button>
    <button si-header-dropdown-item icon="element-user" type="button">Profile</button>
  </si-header-dropdown>
</ng-template>

<ng-template #language>
  <si-header-dropdown>
    <button si-header-dropdown-item type="button">German</button>
    <button si-header-dropdown-item type="button">English</button>
  </si-header-dropdown>
</ng-template>
```
