# List header

> A small section title for lists, with an end slot. A native Pyzed component for Python desktop GUIs, with a live preview, code examples and its API.

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

:::tip[In plain words]
A small title above a group of rows.
:::

A muted section header for lists, with an optional widget at the end (usually an icon button).

`ui.list_header` · Category: [Lists and menus](https://albakore.github.io/pyzed/library/#lists-and-menus) · [Full reference →](https://albakore.github.io/pyzed/reference/ui/#list_header)

**Code:**

```python
pz.column([
    ui.list_header("RECENT", end=ui.icon_button("plus", on_new, size="xs")),
    ui.list_item("main.py", on_open, icon="file-code", inset=True),
    ui.list_item("app.py", on_open, icon="file-code", inset=True),
    ui.list_header("PINNED"),
    ui.list_item("README.md", on_open, icon="file-text", inset=True),
], width=300)
```

## When to use

- To split a list into groups (RECENT, PINNED) or to add an action to a list.

## Usage

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

pz.column([
    ui.list_header("RECENT", end=ui.icon_button("plus", on_new, size="xs")),
    ui.list_item("main.py", on_open, icon="file-code", inset=True),
    ui.list_item("app.py", on_open, icon="file-code", inset=True),
    ui.list_header("PINNED"),
    ui.list_item("README.md", on_open, icon="file-text", inset=True),
], width=300)
```

## Variants

:::note[About these captures]
Each capture is recorded by pyzed itself, off-screen at 2x, in One Dark or One 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.list_header("RECENT"), width=240)
```

```python
pz.container(ui.list_header("PINNED", end=ui.icon_button("plus", on_new, size="xs")), width=240)
```

```python
pz.container(ui.list_header("CHANGES", end=ui.count_badge(4)), width=240)
```

## Events

List header 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.list_header`

```python
list_header(title, *, end=None, theme=None)
```

A section header for lists.

| Property | Default | Description |
| --- | --- | --- |
| `title` | *required* | Title. |
| `end` | `None` | Widgets at the end (right). |
| `theme` | `None` | Theme to use instead of the current one (`pyzed.theme.current()`). |

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

## Related

- [List item](https://albakore.github.io/pyzed/library/list-item/): A list row with icon, text and an end slot.
- [Panel header](https://albakore.github.io/pyzed/library/panel-header/): Icon, title and actions on top of a dock.
