> For the complete documentation index, see [llms.txt](https://developer.supervisely.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.supervisely.com/app-development/widgets/layouts-and-containers/sidebar.md).

# Sidebar

## Introduction

**`Sidebar`** widget from Supervisely is a tool that provides quick access to important information and features in Supervisely apps. `Sidebar` is a vertical panel that appears on the left side of the app interface and includes widget user will placed in. `Sidebar` widget is a useful tool for streamlining workflows and improving user productivity in the apps.

## Function signature

```python
Sidebar(
    left_content=Button(),
    right_content=Card("Input", content=Input()),
    width_percent=25,
    widget_id=None,
)
```

<figure><img src="https://user-images.githubusercontent.com/79905215/224029407-3e2d1e59-2210-4069-b106-1ccbd112b5b5.png" alt=""><figcaption></figcaption></figure>

## Parameters

|    Parameters   |   Type   |                  Description                 |
| :-------------: | :------: | :------------------------------------------: |
|  `left_content` | `Widget` |  Widget to display in left part of `Sidebar` |
| `right_content` | `Widget` | Widget to display in right part of `Sidebar` |
| `width_percent` |   `int`  |   Width of the left part of `Sidebar` in %   |
|     `height`    |   `str`  | Height of sidebar, can be set in px, % or hv |
|   `standalone`  |  `bool`  |       Add paddings for full screen apps      |
|   `widget_id`   |   `str`  |               Id of the widget               |

### left\_content

Determine `Widget` to display in left part of `Sidebar`.

**type:** `Widget`

### right\_content

Determine `Widget` to display in right part of `Sidebar`.

**type:** `Widget`

```python
left = Button(text="Left Button")
right = Button(text="Right Button")
sidebar = Sidebar(left_content=left, right_content=right)
```

<figure><img src="https://user-images.githubusercontent.com/120389559/218466287-28579783-ceb6-4f50-aea3-87c24b11d968.png" alt=""><figcaption></figcaption></figure>

### width\_percent

Determines width of the left part of `Sidebar` in %.

**type:** `int`

**default value:** `25`

```python
left = Button(text="Left Button")
right = Button(text="Right Button")
sidebar = Sidebar(left_content=left, right_content=right, width_percent=75)
```

<figure><img src="https://user-images.githubusercontent.com/120389559/218466726-aab7e4d6-319b-4bcc-b7b6-4aa324269ac6.png" alt=""><figcaption></figcaption></figure>

### height

Height of sidebar, can be set in `px`,`%` or `hv`.

**type:** `str`

```python
left = Button(text="Left Button")
right = Button(text="Right Button")
sidebar = Sidebar(left_content=left, right_content=right, height="250px")
```

<figure><img src="https://github.com/supervisely-ecosystem/ui-widgets-demos/assets/48913536/b25faee3-69df-48d7-ac68-1c955dbb0f0f" alt=""><figcaption></figcaption></figure>

### standalone

Add paddings for full screen apps.

**type:** `bool`

**default value:** `False`

```python
left = Button(text="Left Button")
right = Button(text="Right Button")
sidebar = Sidebar(left_content=left, right_content=right, height="350px", standalone=True)
```

<figure><img src="https://github.com/supervisely-ecosystem/ui-widgets-demos/assets/48913536/e78afe2f-3c82-4aae-8818-46ee4aa280a6" alt=""><figcaption></figcaption></figure>

### widget\_id

ID of the widget.

**type:** `str`

**default value:** `None`

## Mini App Example

You can find this example in our Github repository:

[ui-widgets-demos/layouts and containers/009\_sidebar/src/main.py](https://github.com/supervisely-ecosystem/ui-widgets-demos/blob/master/layouts%20and%20containers/009_sidebar/src/main.py)

### Import libraries

```python
import os

import supervisely as sly
from dotenv import load_dotenv
from supervisely.app.widgets import Select, Sidebar, Text
```

### Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

```python
load_dotenv("local.env")
load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api()
```

### Initialize left and right widgets

```python
left = Text(text="left part", status="success")
items = [
    Select.Item(label="CPU", value="cpu"),
    Select.Item(label="GPU 0", value="cuda:0"),
    Select.Item(value="option3"),
]
right = Select(items=items, filterable=True, placeholder="select me")
```

### Initialize `Sidebar` widget

```python
sidebar = Sidebar(left_content=left, right_content=right)
```

### Create app using layout

Create an app object with layout parameter.

```python
app = sly.Application(layout=sidebar)
```

<figure><img src="https://user-images.githubusercontent.com/120389559/218459213-d0e7e1f3-b073-47c0-a759-b3741cb1df2a.gif" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.supervisely.com/app-development/widgets/layouts-and-containers/sidebar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
