The icon sidebar is a vertical navigation bar that is used to structure content within an application. It enables quick and intuitive navigation between different areas or functions of the application. The icon sidebar can contain links or buttons.

| Number | Type | Description | Optional | Info |
|---|---|---|---|---|
| 1 | Component | sbb-icon-sidebar | No | |
| 2 | Component | sbb-icon-sidebar-button or sbb-icon-sidebar-link | No | |
| 2a | Component | sbb-icon-sidebar-button or sbb-icon-sidebar-link | No | Hover state with tooltip |
| 2b | Component | sbb-icon-sidebar-button or sbb-icon-sidebar-link | No | Current state |
| 3 | Component | sbb-sidebar-title | Yes | |
| 4 | Component | sbb-sidebar-close-button | Yes | |
| 5 | Content | No | ||
| 6 | Property | Backdrop | Yes | Only visible in overlay mode |
The <sbb-icon-sidebar> is a component that can display action items with an icon on the left or right side of the viewport.
The icon sidebar components are designed to add side content to a fullscreen app.
To set up an icon sidebar we use three components: <sbb-icon-sidebar-container> which acts as a structural container for
our content and sidebar, <sbb-icon-sidebar-content> which represents the main content,
and <sbb-icon-sidebar> which represents the added side content.
<sbb-icon-sidebar-container>
<sbb-icon-sidebar>
<sbb-icon-sidebar-link
sbb-tooltip="Go to the party"
accessibility-label="Go to the party"
icon-name="glass-cocktail-small"
href="#"
></sbb-icon-sidebar-link>
<sbb-icon-sidebar-link
sbb-tooltip="Be a unicorn"
accessibility-label="Be a unicorn"
icon-name="unicorn-small"
href="#"
class="sbb-active"
accessibility-current="page"
></sbb-icon-sidebar-link>
</sbb-icon-sidebar>
<sbb-icon-sidebar-content role="main">
<p style="padding: var(--sbb-spacing-fixed-4x); margin: 0">
In the enchanting world of fantasy, unicorns are legendary creatures known for their grace,
purity, and magical abilities. These mystical beings have inspired countless tales of bravery
and wonder. Here, we delve into some captivating unicorn success stories that continue to
enchant and inspire, each with a touch of public transport magic.
</p>
</sbb-icon-sidebar-content>
</sbb-icon-sidebar-container>
Per default, the <sbb-icon-sidebar> receives a white background color. As alternative,
it's possible to set the color property to milk.
If using the <sbb-icon-sidebar> along with a <sbb-sidebar>, it's recommended to alternate
the background colors (white / milk) for a clear visual distinction.
<sbb-icon-sidebar color="milk"></sbb-icon-sidebar>
An <sbb-icon-sidebar> can be positioned at the left or right side of the viewport.
To display the icon sidebar on the right side, place the <sbb-icon-sidebar>
after the <sbb-icon-sidebar-content> in the DOM.
Technically it's possible to place two icon sidebars, but from UX perspective it's not recommended.
positioned on the right side:
<sbb-icon-sidebar-container>
<sbb-icon-sidebar-content role="main">Content</sbb-icon-sidebar-content>
<sbb-icon-sidebar>Sidebar Content</sbb-icon-sidebar>
</sbb-icon-sidebar-container>
The <sbb-icon-sidebar> has the role navigation applied.
The <sbb-sidebar-content> should be given a role based on what it contains. If it
represents the primary content of the page, it may make sense to mark it role="main". If no more
specific role makes sense, role="region" is a good fallback.
As described in sbb-icon-sidebar-link and
sbb-icon-sidebar-button, it's important to set
both a label and a tooltip to the action elements.
It's also described how to set the current icon as active (aria-current).
sbb-sidebarIt's possible the combine the <sbb-icon-sidebar> with the <sbb-sidebar> as following:
<sbb-icon-sidebar-container>
<sbb-icon-sidebar>Icon sidebar content</sbb-icon-sidebar>
<sbb-icon-sidebar-content>
<sbb-sidebar-container>
<sbb-sidebar role="navigation">Sidebar content</sbb-sidebar>
<sbb-sidebar-content role="main">Content</sbb-sidebar-content>
</sbb-sidebar-container>
</sbb-icon-sidebar-content>
</sbb-icon-sidebar-container>
sbb-headerCheck sbb-icon-sidebar-container on how to
position and connect the sbb-header with the icon sidebar.
| Name | Attribute | Privacy | Type | Default | Description |
|---|---|---|---|---|---|
color | color | public | 'white' | 'milk' | 'white' | Background color of the icon sidebar. Either white or milk. * |
container | - | public | SbbIconSidebarContainerElement | null | Returns the SbbIconSidebarContainerElement where this icon-sidebar is contained. |
| Name | Description |
|---|---|
| Use the unnamed slot to slot any content into the icon-sidebar. |