Skip to content

Commit

Permalink
Tweak docs. (#3346)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigogiraoserrao authored Sep 19, 2023
1 parent 32a0091 commit 3825f43
Show file tree
Hide file tree
Showing 32 changed files with 309 additions and 66 deletions.
2 changes: 1 addition & 1 deletion docs/widgets/_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Example app showing the widget:
```


## Reactive attributes
## Reactive Attributes


## Bindings
Expand Down
8 changes: 8 additions & 0 deletions docs/widgets/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ Clicking any of the non-disabled buttons in the example app below will result in

- [Button.Pressed][textual.widgets.Button.Pressed]

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

## Additional Notes

- The spacing between the text and the edges of a button are _not_ due to padding. The default styling for a `Button` has the `height` set to 3 lines and a `min-width` of 16 columns. To create a button with zero visible padding, you will need to change these values and also remove the border with `border: none;`.
Expand Down
10 changes: 5 additions & 5 deletions docs/widgets/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ The example below shows check boxes in various states.
| ------- | ------ | ------- | -------------------------- |
| `value` | `bool` | `False` | The value of the checkbox. |

## Messages

- [Checkbox.Changed][textual.widgets.Checkbox.Changed]

## Bindings

The checkbox widget defines the following bindings:
Expand All @@ -45,17 +49,13 @@ The checkbox widget defines the following bindings:

## Component Classes

The checkbox widget provides the following component classes:
The checkbox widget inherits the following component classes:

::: textual.widgets._toggle_button.ToggleButton.COMPONENT_CLASSES
options:
show_root_heading: false
show_root_toc_entry: false

## Messages

- [Checkbox.Changed][textual.widgets.Checkbox.Changed]


---

Expand Down
19 changes: 18 additions & 1 deletion docs/widgets/collapsible.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,29 @@ The following example shows `Collapsible` widgets with custom expand/collapse sy
--8<-- "docs/examples/widgets/collapsible_custom_symbol.py"
```

## Reactive attributes
## Reactive Attributes

| Name | Type | Default | Description |
| ----------- | ------ | ------- | ---------------------------------------------------- |
| `collapsed` | `bool` | `True` | Controls the collapsed/expanded state of the widget. |

## Messages

This widget posts no messages.

## Bindings

The collapsible widget defines the following binding on its title:

::: textual.widgets._collapsible.CollapsibleTitle.BINDINGS
options:
show_root_heading: false
show_root_toc_entry: false

## Component Classes

This widget has no component classes.


::: textual.widgets.Collapsible
options:
Expand Down
12 changes: 12 additions & 0 deletions docs/widgets/content_switcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ When the user presses the "Markdown" button the view is switched:
| --------- | --------------- | ------- | ----------------------------------------------------------------------- |
| `current` | `str` \| `None` | `None` | The ID of the currently-visible child. `None` means nothing is visible. |

## Messages

This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.


---

Expand Down
8 changes: 6 additions & 2 deletions docs/widgets/digits.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ Here's another example which uses `Digits` to display the current time:
--8<-- "docs/examples/widgets/clock.py"
```

## Reactive attributes
## Reactive Attributes

This widget has no reactive attributes.

## Messages

This widget posts no messages.

## Bindings

This widget has no bindings.

## Component classes
## Component Classes

This widget has no component classes.

Expand Down
12 changes: 8 additions & 4 deletions docs/widgets/directory_tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ and directories:
--8<-- "docs/examples/widgets/directory_tree_filtered.py"
~~~

## Messages

- [DirectoryTree.FileSelected][textual.widgets.DirectoryTree.FileSelected]

## Reactive Attributes

| Name | Type | Default | Description |
Expand All @@ -46,6 +42,14 @@ and directories:
| `show_guides` | `bool` | `True` | Show guide lines between levels. |
| `guide_depth` | `int` | `4` | Amount of indentation between parent and child. |

## Messages

- [DirectoryTree.FileSelected][textual.widgets.DirectoryTree.FileSelected]

## Bindings

The directory tree widget inherits [the bindings from the tree widget][textual.widgets.Tree.BINDINGS].

## Component Classes

The directory tree widget provides the following component classes:
Expand Down
6 changes: 5 additions & 1 deletion docs/widgets/footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ widget. Notice how the `Footer` automatically displays the keybinding.

## Messages

This widget sends no messages.
This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

Expand Down
10 changes: 9 additions & 1 deletion docs/widgets/header.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ This example shows how to set the text in the `Header` using `App.title` and `Ap

## Messages

This widget sends no messages.
This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

---

Expand Down
2 changes: 1 addition & 1 deletion docs/widgets/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ as seen for `Palindrome` in the example above.

## Bindings

The Input widget defines the following bindings:
The input widget defines the following bindings:

::: textual.widgets.Input.BINDINGS
options:
Expand Down
10 changes: 9 additions & 1 deletion docs/widgets/label.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ This widget has no reactive attributes.

## Messages

This widget sends no messages.
This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

---

Expand Down
13 changes: 9 additions & 4 deletions docs/widgets/list_item.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ of multiple `ListItem`s. The arrow keys can be used to navigate the list.
| ------------- | ------ | ------- | ------------------------------------ |
| `highlighted` | `bool` | `False` | True if this ListItem is highlighted |

## Messages

#### Attributes
This widget posts no messages.

| attribute | type | purpose |
| --------- | ---------- | --------------------------- |
| `item` | `ListItem` | The item that was selected. |
## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

---

Expand Down
10 changes: 7 additions & 3 deletions docs/widgets/list_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ The example below shows an app with a simple `ListView`.

## Reactive Attributes

| Name | Type | Default | Description |
| ------- | ----- | ------- | ------------------------------- |
| `index` | `int` | `0` | The currently highlighted index |
| Name | Type | Default | Description |
| ------- | ----- | ------- | -------------------------------- |
| `index` | `int` | `0` | The currently highlighted index. |

## Messages

Expand All @@ -49,6 +49,10 @@ The list view widget defines the following bindings:
show_root_heading: false
show_root_toc_entry: false

## Component Classes

This widget has no component classes.

---


Expand Down
36 changes: 29 additions & 7 deletions docs/widgets/loading_indicator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ Displays pulsating dots to indicate when data is being loaded.
- [ ] Focusable
- [ ] Container

## Example

Simple usage example:

=== "Output"

```{.textual path="docs/examples/widgets/loading_indicator.py"}
```

=== "loading_indicator.py"

```python
--8<-- "docs/examples/widgets/loading_indicator.py"
```

## Changing Indicator Color

You can set the color of the loading indicator by setting its `color` style.

Here's how you would do that with CSS:
Expand All @@ -17,17 +34,22 @@ LoadingIndicator {
}
```

## Reactive Attributes

=== "Output"
This widget has no reactive attributes.

```{.textual path="docs/examples/widgets/loading_indicator.py"}
```
## Messages

=== "loading_indicator.py"
This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

```python
--8<-- "docs/examples/widgets/loading_indicator.py"
```
---


Expand Down
11 changes: 9 additions & 2 deletions docs/widgets/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ The example below shows how to write text to a `Log` widget:
| `max_lines` | `int` | `None` | Maximum number of lines in the log or `None` for no maximum. |
| `auto_scroll` | `bool` | `False` | Scroll to end of log when new lines are added. |


## Messages

This widget sends no messages.
This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.


---
Expand Down
17 changes: 17 additions & 0 deletions docs/widgets/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,29 @@ The following example displays Markdown from a string.
--8<-- "docs/examples/widgets/markdown.py"
~~~

## Reactive Attributes

This widget has no reactive attributes.

## Messages

- [Markdown.TableOfContentsUpdated][textual.widgets.Markdown.TableOfContentsUpdated]
- [Markdown.TableOfContentsSelected][textual.widgets.Markdown.TableOfContentsSelected]
- [Markdown.LinkClicked][textual.widgets.Markdown.LinkClicked]

## Bindings

This widget has no bindings.

## Component Classes

The markdown widget provides the following component classes:

::: textual.widgets.Markdown.COMPONENT_CLASSES
options:
show_root_heading: false
show_root_toc_entry: false


## See Also

Expand Down
12 changes: 12 additions & 0 deletions docs/widgets/markdown_viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ The following example displays Markdown from a string and a Table of Contents.
| ------------------------ | ---- | ------- | ----------------------------------------------------------------- |
| `show_table_of_contents` | bool | True | Wether a Table of Contents should be displayed with the Markdown. |

## Messages

This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

## See Also

* [Markdown][textual.widgets.Markdown] code reference
Expand Down
10 changes: 9 additions & 1 deletion docs/widgets/placeholder.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ The example below shows each placeholder variant.

## Messages

This widget sends no messages.
This widget posts no messages.

## Bindings

This widget has no bindings.

## Component Classes

This widget has no component classes.

---

Expand Down
Loading

0 comments on commit 3825f43

Please sign in to comment.