mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add the basics of Label docs for the manual
This commit is contained in:
1
docs/api/label.md
Normal file
1
docs/api/label.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
::: textual.widgets.Label
|
||||||
12
docs/examples/widgets/label.py
Normal file
12
docs/examples/widgets/label.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.widgets import Label
|
||||||
|
|
||||||
|
|
||||||
|
class LabelApp(App):
|
||||||
|
def compose(self) -> ComposeResult:
|
||||||
|
yield Label("Hello, world!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = LabelApp()
|
||||||
|
app.run()
|
||||||
33
docs/widgets/label.md
Normal file
33
docs/widgets/label.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Label
|
||||||
|
|
||||||
|
A widget which displays static text, but which can also contain more complex Rich renderables.
|
||||||
|
|
||||||
|
- [ ] Focusable
|
||||||
|
- [x] Container
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
The example below shows how you can use a `Label` widget to display some text.
|
||||||
|
|
||||||
|
=== "Output"
|
||||||
|
|
||||||
|
```{.textual path="docs/examples/widgets/label.py"}
|
||||||
|
```
|
||||||
|
|
||||||
|
=== "label.py"
|
||||||
|
|
||||||
|
```python
|
||||||
|
--8<-- "docs/examples/widgets/label.py"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Reactive Attributes
|
||||||
|
|
||||||
|
This widget has no reactive attributes.
|
||||||
|
|
||||||
|
## Messages
|
||||||
|
|
||||||
|
This widget sends no messages.
|
||||||
|
|
||||||
|
## See Also
|
||||||
|
|
||||||
|
* [Label](../api/label.md) code reference
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
# Static
|
# Static
|
||||||
|
|
||||||
A widget which displays static content.
|
A widget which displays static content.
|
||||||
Can be used for simple text labels, but can also contain more complex Rich renderables.
|
Can be used for Rich renderables and can also for the base for other types of widgets.
|
||||||
|
|
||||||
- [ ] Focusable
|
- [ ] Focusable
|
||||||
- [x] Container
|
- [x] Container
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
The example below shows how you can use a `Static` widget as a simple text label.
|
The example below shows how you can use a `Static` widget as a simple text label (but see [Label](./label.md) as a way of displaying text).
|
||||||
|
|
||||||
=== "Output"
|
=== "Output"
|
||||||
|
|
||||||
@@ -32,3 +32,4 @@ This widget sends no messages.
|
|||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
* [Static](../api/static.md) code reference
|
* [Static](../api/static.md) code reference
|
||||||
|
* [Label](./label.md)
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ nav:
|
|||||||
- "widgets/footer.md"
|
- "widgets/footer.md"
|
||||||
- "widgets/header.md"
|
- "widgets/header.md"
|
||||||
- "widgets/input.md"
|
- "widgets/input.md"
|
||||||
|
- "widgets/label.md"
|
||||||
- "widgets/static.md"
|
- "widgets/static.md"
|
||||||
- "widgets/tree_control.md"
|
- "widgets/tree_control.md"
|
||||||
- API:
|
- API:
|
||||||
@@ -109,6 +110,7 @@ nav:
|
|||||||
- "api/footer.md"
|
- "api/footer.md"
|
||||||
- "api/geometry.md"
|
- "api/geometry.md"
|
||||||
- "api/header.md"
|
- "api/header.md"
|
||||||
|
- "api/label.md"
|
||||||
- "api/message_pump.md"
|
- "api/message_pump.md"
|
||||||
- "api/message.md"
|
- "api/message.md"
|
||||||
- "api/pilot.md"
|
- "api/pilot.md"
|
||||||
|
|||||||
Reference in New Issue
Block a user