mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
More documentation for Input widget
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
A simple footer widget which is docked to the bottom of its parent container. Displays
|
||||
available keybindings for the currently focused widget.
|
||||
|
||||
- [ ] Focusable
|
||||
- [ ] Container
|
||||
|
||||
## Example
|
||||
|
||||
The example below shows an app with a single keybinding that contains only a `Footer`
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
A simple header widget which docks itself to the top of the parent container.
|
||||
|
||||
- [ ] Focusable
|
||||
- [ ] Container
|
||||
|
||||
## Example
|
||||
|
||||
The example below shows an app with a `Header`.
|
||||
|
||||
68
docs/widgets/input.md
Normal file
68
docs/widgets/input.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# Input
|
||||
|
||||
## Description
|
||||
|
||||
A single-line text input widget.
|
||||
|
||||
- [x] Focusable
|
||||
- [ ] Container
|
||||
|
||||
## Example
|
||||
|
||||
The example below shows how you might create a simple form using two `Input` widgets.
|
||||
|
||||
=== "Output"
|
||||
|
||||
```{.textual path="docs/examples/widgets/input.py"}
|
||||
```
|
||||
|
||||
=== "input.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/widgets/input.py"
|
||||
```
|
||||
|
||||
## Reactive Attributes
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|-------------------|--------|---------|-----------------------------------------------------------------|
|
||||
| `cursor_blink` | `bool` | `True` | True if cursor blinking is enabled. |
|
||||
| `value` | `str` | `""` | The value currently in the text input. |
|
||||
| `cursor_position` | `int` | `0` | The index of the cursor in the value string. |
|
||||
| `placeholder` | `str` | `str` | The dimmed placeholder text to display when the input is empty. |
|
||||
| `password` | `bool` | `False` | True if the input should be masked. |
|
||||
|
||||
## Messages
|
||||
|
||||
### Changed
|
||||
|
||||
The `Input.Changed` message is sent when the value in the text input changes.
|
||||
|
||||
- [x] Bubbles
|
||||
|
||||
#### Attributes
|
||||
|
||||
| attribute | type | purpose |
|
||||
|-----------|-------|----------------------------------|
|
||||
| `value` | `str` | The new value in the text input. |
|
||||
|
||||
|
||||
### Submitted
|
||||
|
||||
- [x] Bubbles
|
||||
|
||||
#### Attributes
|
||||
|
||||
| attribute | type | purpose |
|
||||
|-----------|-------|----------------------------------|
|
||||
| `value` | `str` | The new value in the text input. |
|
||||
|
||||
|
||||
## Additional Notes
|
||||
|
||||
* The spacing around the text content is due to border. To remove it, set `border: none;` in your CSS.
|
||||
*
|
||||
|
||||
## See Also
|
||||
|
||||
* [Input](../reference/input.md) code reference
|
||||
@@ -5,6 +5,9 @@
|
||||
A widget which displays a static renderable content.
|
||||
Can be used for simple text labels, but can also contain more complex Rich renderables.
|
||||
|
||||
- [ ] Focusable
|
||||
- [x] Container
|
||||
|
||||
## Example
|
||||
|
||||
The example below shows how you can use a `Static` widget as a simple text label.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
# TextInput
|
||||
Reference in New Issue
Block a user