# Description list

> Name and value pairs, one per row. A native Pyzed component for Python desktop GUIs, with a live preview, code examples and its API.

Source: https://albakore.github.io/pyzed/library/description-list/

:::tip[In plain words]
A short list of names and values, like the details of a file.
:::

The details of something, one property per row: names on the left (or above with `vertical`) and their values, which can be text or any widget such as a badge. Text values can be selected and copied.

`ui.description_list` · Category: [Data](https://albakore.github.io/pyzed/library/#data) · [Full reference →](https://albakore.github.io/pyzed/reference/ui/#description_list)

**Code:**

```python
pz.container(ui.description_list({
    "Name": "report.pdf",
    "Size": "2.4 MB",
    "Modified": "Today, 10:42",
    "Status": ui.badge("Synced", tint="success"),
}), width=360)
```

:::note[New]
This component was added recently. Tell us how it works for you in the [issue tracker](https://github.com/albakore/pyzed/issues).
:::

## When to use

- For the properties of a file, an order, a user or a device.
- For many rows of the same columns, use a [Table](https://albakore.github.io/pyzed/library/table/).

## Usage

```python
import pyzed as pz
from pyzed import ui

pz.container(ui.description_list({
    "Name": "report.pdf",
    "Size": "2.4 MB",
    "Modified": "Today, 10:42",
    "Status": ui.badge("Synced", tint="success"),
}), width=360)
```

## Variants

:::note[About these captures]
Each capture is recorded by pyzed itself, off-screen at 2x, in Pyzed Dark or Pyzed Light to match this site's theme, and cropped to the component so it shows at its real size. The pointer hovers, presses or types into it; a component that does not react to the pointer cycles through a few themes. With reduced motion you see the first frame. Open **Code** under a capture to see the snippet that draws it; free names such as `on_save` stand for your own callbacks.
:::

### Options

```python
pz.container(ui.description_list({"Owner": "Ada", "Plan": "Pro", "Seats": 12}), width=320)
```

```python
pz.container(ui.description_list({"Email": "ada@example.com", "Phone": "+44 20 7946 0000"}, vertical=True), width=320)
```

```python
pz.container(ui.description_list([("Commit", "26a7ccf"), ("Branch", "main")], mono_values=True, label_width=90), width=320)
```

```python
pz.container(ui.description_list({"Width": "1280", "Height": "720"}, dividers=False, label_width=90), width=280)
```

## Events

Description list has no events of its own: it shows what you give it. Like every widget it also has the **18 common events** (`click`, `double_click`, `right_click`, `mouse_enter`, `drag`, `key_down`, `resize`…), attached with `.on(...)`: see [Events](https://albakore.github.io/pyzed/guides/events/) and [Events of every component](https://albakore.github.io/pyzed/library/events/).

## Properties and API

### `ui.description_list`

```python
description_list(
    items,
    *,
    label_width=140,
    vertical=False,
    dividers=True,
    mono_values=False,
    selectable=True,
    theme=None,
)
```

Name and value pairs, one per row: the details of a file, an order or a device. A value can be text or any widget.

| Property | Default | Description |
| --- | --- | --- |
| `items` | *required* | A dict or `(name, value)` pairs. |
| `label_width` | `140` | Width of the names column. |
| `vertical` | `False` | Puts each name above its value. |
| `dividers` | `True` | Lines between rows. |
| `mono_values` | `False` | Text values in the monospace font (ids, hashes). |
| `selectable` | `True` | Text values can be selected and copied. |
| `theme` | `None` | Theme to use instead of the current one (`pyzed.theme.current()`). |

[Full reference →](https://albakore.github.io/pyzed/reference/ui/#description_list)

## Related

- [Table](https://albakore.github.io/pyzed/library/table/): A data table with a fixed header, sorting and selection.
- [Settings group](https://albakore.github.io/pyzed/library/settings-group/): A titled block of field rows, for settings screens.
- [Card](https://albakore.github.io/pyzed/library/card/): A bordered surface with an optional title and actions.
