# Indicator

> A colored dot for status, presence or unsaved changes. A native Pyzed component for Python desktop GUIs, with a live preview, code examples and its API.

Source: https://albakore.github.io/pyzed/library/indicator/

:::tip[In plain words]
A small colored dot that tells a state at a glance: green is fine, red is a problem.
:::

A small colored dot. `color` is a theme token or a hex color and `size` its diameter.

`ui.indicator` · Category: [Display](https://albakore.github.io/pyzed/library/#display) · [Full reference →](https://albakore.github.io/pyzed/reference/ui/#indicator)

**Code:**

```python
pz.column([
    pz.row([ui.indicator("success"), ui.label("Server running")], spacing=8, align="center"),
    pz.row([ui.indicator("warning"), ui.label("Reconnecting")], spacing=8, align="center"),
    pz.row([ui.indicator("error"), ui.label("Build failed")], spacing=8, align="center"),
    pz.row([ui.indicator(size=10), ui.label("Unsaved changes")], spacing=8, align="center"),
], spacing=10)
```

## When to use

- Next to a name to show presence (online, busy) or a state (running, failed).
- On a tab or list item to mark unsaved changes.

## Usage

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

pz.column([
    pz.row([ui.indicator("success"), ui.label("Server running")], spacing=8, align="center"),
    pz.row([ui.indicator("warning"), ui.label("Reconnecting")], spacing=8, align="center"),
    pz.row([ui.indicator("error"), ui.label("Build failed")], spacing=8, align="center"),
    pz.row([ui.indicator(size=10), ui.label("Unsaved changes")], spacing=8, align="center"),
], spacing=10)
```

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

### Color

```python
ui.indicator()
```

```python
ui.indicator("success")
```

```python
ui.indicator("warning")
```

```python
ui.indicator("error")
```

```python
ui.indicator("text_muted")
```

```python
ui.indicator("#c678dd")
```

### Size

```python
ui.indicator("success", size=6)
```

```python
ui.indicator("success", size=10)
```

```python
ui.indicator("success", size=14)
```

### Next to text

```python
pz.row([ui.indicator("success"), ui.label("Ana is online")], spacing=8, align="center")
```

```python
pz.row([ui.label("notes.py"), ui.indicator(size=8)], spacing=6, align="center")
```

## Events

Indicator 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.indicator`

```python
indicator(color='accent', *, size=6, theme=None)
```

A colored dot (status, unsaved changes, presence).

| Property | Default | Description |
| --- | --- | --- |
| `color` | `"accent"` | Token or color. |
| `size` | `6` | Diameter. |
| `theme` | `None` | Theme to use instead of the current one (`pyzed.theme.current()`). |

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

## Related

- [Badge](https://albakore.github.io/pyzed/library/badge/): A small pill for statuses, versions and counters.
- [Avatar](https://albakore.github.io/pyzed/library/avatar/): A round avatar with initials in a collaborator color.
