Document Header widget

This commit is contained in:
Darren Burns
2022-10-04 11:43:30 +01:00
parent ec14ed25d2
commit 14af7be6fd
5 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
from textual.app import App, ComposeResult
from textual.widgets import Header
class HeaderApp(App):
def compose(self) -> ComposeResult:
yield Header()
if __name__ == "__main__":
app = HeaderApp()
app.run()

1
docs/reference/header.md Normal file
View File

@@ -0,0 +1 @@
::: textual.widgets.Header

View File

@@ -15,7 +15,7 @@ widget. Notice how the `Footer` automatically displays the keybind.
```{.textual path="docs/examples/widgets/footer.py"} ```{.textual path="docs/examples/widgets/footer.py"}
``` ```
=== "button.py" === "footer.py"
```python ```python
--8<-- "docs/examples/widgets/footer.py" --8<-- "docs/examples/widgets/footer.py"

View File

@@ -1 +1,34 @@
# Header # Header
## Description
A simple header widget which docks itself to the top of the parent container.
## Example
The example below shows an app with a `Header`.
=== "Output"
```{.textual path="docs/examples/widgets/header.py"}
```
=== "header.py"
```python
--8<-- "docs/examples/widgets/header.py"
```
## Reactive Attributes
| Name | Type | Default | Description |
|--------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tall` | `bool` | `True` | Whether the `Header` widget is displayed as tall or not. The tall variant is 3 cells tall by default. The non-tall variant is a single cell tall. This can be toggled by clicking on the header. |
## Messages
This widget sends no messages.
## See Also
* [Header](../reference/header.md) code reference

View File

@@ -102,6 +102,7 @@ nav:
- "reference/events.md" - "reference/events.md"
- "reference/footer.md" - "reference/footer.md"
- "reference/geometry.md" - "reference/geometry.md"
- "reference/header.md"
- "reference/index.md" - "reference/index.md"
- "reference/message_pump.md" - "reference/message_pump.md"
- "reference/message.md" - "reference/message.md"