# Skeleton

> A pulsing placeholder while content loads. A native Pyzed component for Python desktop GUIs, with a live preview, code examples and its API.

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

:::tip[In plain words]
Grey shapes that softly blink while the real content is loading.
:::

Grey shapes that pulse where text, pictures or rows will appear, so the layout does not jump when they arrive. `lines` makes a paragraph and `circle` an avatar.

`ui.skeleton` · Category: [Feedback](https://albakore.github.io/pyzed/library/#feedback) · [Full reference →](https://albakore.github.io/pyzed/reference/ui/#skeleton)

**Code:**

```python
pz.container(pz.row([
    ui.skeleton(height=40, circle=True),
    pz.column([ui.skeleton(width=160, height=14), ui.skeleton(lines=2, height=10)], spacing=10, width="fill"),
], spacing=12), 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

- While a list, a profile or a card is loading.
- For a short wait with no known shape, a [Spinner](https://albakore.github.io/pyzed/library/spinner/) is enough.

## Usage

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

pz.container(pz.row([
    ui.skeleton(height=40, circle=True),
    pz.column([ui.skeleton(width=160, height=14), ui.skeleton(lines=2, height=10)], spacing=10, width="fill"),
], spacing=12), 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.skeleton(height=14), width=320)
```

```python
pz.container(ui.skeleton(lines=3, height=10), width=320)
```

```python
ui.skeleton(height=48, circle=True)
```

```python
pz.container(pz.column([ui.skeleton(height=120, radius=8), ui.skeleton(width=180, height=14), ui.skeleton(lines=2, height=10)], spacing=10), width=280)
```

### States and events

```python
pz.container(ui.skeleton(lines=2, animated=False), width=320)
```

## Events

Skeleton 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.skeleton`

```python
skeleton(
    width='fill',
    height=12,
    *,
    lines=1,
    circle=False,
    radius=None,
    spacing=8,
    animated=True,
    theme=None,
)
```

A grey placeholder that pulses where content is still loading. `lines` makes a paragraph and `circle` an avatar.

| Property | Default | Description |
| --- | --- | --- |
| `width` | `"fill"` | Width: pixels, `"fill"`, `"shrink"` or `"fill:N"` (proportion). |
| `height` | `12` | Height of each bar (the diameter with `circle`). |
| `lines` | `1` | Stacks several bars, the last one shorter. |
| `circle` | `False` | A round placeholder of `height`. |
| `radius` | `None` | Corner radius: a number or `(top_left, top_right, bottom_right, bottom_left)`. |
| `spacing` | `8` | Space between children, in pixels. |
| `animated` | `True` | Pulses (it stays still when the system asks for reduced motion). |
| `theme` | `None` | Theme to use instead of the current one (`pyzed.theme.current()`). |

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

## Related

- [Spinner](https://albakore.github.io/pyzed/library/spinner/): A spinning arc for loading states.
- [Progress](https://albakore.github.io/pyzed/library/progress/): A thin progress bar in a semantic color.
- [Empty state](https://albakore.github.io/pyzed/library/empty-state/): A centered placeholder for empty lists and searches.
