Files
textual/docs/styles/layer.md
darrenburns 9e883d3e45 Document styles (#785)
* Add docs for CSS variables

* Add ref docs for various styles, fix some typos in places
2022-09-15 16:32:23 +01:00

1.0 KiB

Layer

The layer property is used to assign widgets to a layer. The value of the layer property must be the name of a layer defined using a layers declaration. Layers control the order in which widgets are painted on screen. More information on layers can be found in the guide.

Syntax

layer: <STRING>;

Example

In the example below, #box1 is yielded before #box2. However, since #box1 is on the higher layer, it is drawn on top of #box2.

=== "Output"

```{.textual path="docs/examples/guide/layout/layers.py"}
```

=== "layers.py"

```python
--8<-- "docs/examples/guide/layout/layers.py"
```

=== "layers.css"

```sass hl_lines="3 15 19"
--8<-- "docs/examples/guide/layout/layers.css"
```

CSS

/* Draw the widget on the layer called 'below' */
layer: below;

Python

# Draw the widget on the layer called 'below'
widget.layer = "below"