mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* tabbed content widget * TabbedContent widget and docs * missing docs * fix active * doc fix * test fix * additional test * test for render_str * docstring * changelog * doc update * changelog * fix bad optimization * Update docs/widgets/tabbed_content.md Co-authored-by: Dave Pearson <davep@davep.org> * fix for empty initial * docstrings * Update src/textual/widgets/_content_switcher.py Co-authored-by: Dave Pearson <davep@davep.org> * docstring * remove log * permit nested tabs * renamed TabsCleared to Cleared * added tests, fix types on click * tests * fix broken test * fix for nested tabs --------- Co-authored-by: Dave Pearson <davep@davep.org>
1.2 KiB
1.2 KiB
Switch
A simple switch widget which stores a boolean value.
- Focusable
- Container
Example
The example below shows switches in various states.
=== "Output"
```{.textual path="docs/examples/widgets/switch.py"}
```
=== "switch.py"
```python
--8<-- "docs/examples/widgets/switch.py"
```
=== "switch.css"
```sass
--8<-- "docs/examples/widgets/switch.css"
```
Reactive Attributes
| Name | Type | Default | Description |
|---|---|---|---|
value |
bool |
False |
The value of the switch. |
Bindings
The switch widget defines the following bindings:
::: textual.widgets.Switch.BINDINGS options: show_root_heading: false show_root_toc_entry: false
Component Classes
The switch widget provides the following component classes:
::: textual.widgets.Switch.COMPONENT_CLASSES options: show_root_heading: false show_root_toc_entry: false
Messages
::: textual.widgets.Switch.Changed
Additional Notes
- To remove the spacing around a
Switch, setborder: none;andpadding: 0;.
See Also
- Switch code reference