# Panel header

> Icon, title and actions on top of a dock. A native Pyzed component for Python desktop GUIs, with a live preview, code examples and its API.

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

:::tip[In plain words]
The title row of a side panel, with its buttons.
:::

The header of a dock or panel: an optional icon, the title and action buttons on the right.

`ui.panel_header` · Category: [Workspace](https://albakore.github.io/pyzed/library/#workspace) · [Full reference →](https://albakore.github.io/pyzed/reference/ui/#panel_header)

**Code:**

```python
pz.column([
    ui.panel_header("Project", [ui.icon_button("plus", on_new, size="xs"),
                                ui.icon_button("ellipsis", on_menu, size="xs")]),
    ui.panel_header("Terminal", [ui.icon_button("x", on_close, size="xs")], icon="terminal"),
], spacing=12, width=320)
```

## When to use

- At the top of every dock (Project, Outline, Terminal) to name it and hold its actions.

## Usage

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

pz.column([
    ui.panel_header("Project", [ui.icon_button("plus", on_new, size="xs"),
                                ui.icon_button("ellipsis", on_menu, size="xs")]),
    ui.panel_header("Terminal", [ui.icon_button("x", on_close, size="xs")], icon="terminal"),
], spacing=12, width=320)
```

## 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.
:::

### Content

```python
pz.container(ui.panel_header("Project"), width=280)
```

```python
pz.container(ui.panel_header("Terminal", icon="terminal"), width=280)
```

```python
pz.container(ui.panel_header("Project", [ui.icon_button("plus", on_new, size="xs"),
                                     ui.icon_button("ellipsis", on_menu, size="xs")]), width=280)
```

```python
pz.container(ui.panel_header("Outline", height=40), width=280)
```

## Events

Panel 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.panel_header`

```python
panel_header(title, actions=(), *, icon=None, height=32, theme=None)
```

A panel header: icon, title and actions.

| Property | Default | Description |
| --- | --- | --- |
| `title` | *required* | Title. |
| `actions` | `()` | Extra widgets (usually buttons) shown as actions. |
| `icon` | `None` | Name of a Lucide icon (`pyzed icons` lists them). |
| `height` | `32` | Height. |
| `theme` | `None` | Theme to use instead of the current one (`pyzed.theme.current()`). |

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

## Related

- [Panel](https://albakore.github.io/pyzed/library/panel/): A dockable, resizable side panel.
- [List header](https://albakore.github.io/pyzed/library/list-header/): A small section title for lists, with an end slot.
