From 910c4782f1847684bc22e7e007f50ad0a45844f3 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 24 May 2023 15:05:10 +0100 Subject: [PATCH] Add the main framework for the OptionList documentation Lots to flesh out here still, but this gets the core framework in place. --- docs/widgets/selection_list.md | 77 ++++++++++++++++++++++++++++++++++ mkdocs-nav.yml | 1 + 2 files changed, 78 insertions(+) create mode 100644 docs/widgets/selection_list.md diff --git a/docs/widgets/selection_list.md b/docs/widgets/selection_list.md new file mode 100644 index 000000000..017fffc54 --- /dev/null +++ b/docs/widgets/selection_list.md @@ -0,0 +1,77 @@ +# SelectionList + +!!! tip "Added in version 0.??.0" + +A widget for showing a vertical list check boxes. + +- [x] Focusable +- [ ] Container + +## Examples + +Some super-cool examples will appear here! + +## Reactive Attributes + +| Name | Type | Default | Description | +|---------------|-----------------|---------|------------------------------------------------------------------------------| +| `highlighted` | `int` \| `None` | `None` | The index of the highlighted selection. `None` means nothing is highlighted. | + +## Messages + +The following messages will be posted as the user interacts with the list: + +- [SelectionList.SelectionHighlighted][textual.widgets.SelectionList.SelectionHighlighted] +- [SelectionList.SelectionToggled][textual.widgets.SelectionList.SelectionToggled] + +The following message will be posted if the content of +[`selected`][textual.widgets.SelectionList.selected] changes, either by user +interaction or by API calls: + +- [SelectionList.SelectedChanged][textual.widgets.SelectionList.SelectedChanged] + +## Bindings + +The selection list widget defines the following bindings: + +::: textual.widgets.SelectionList.BINDINGS + options: + show_root_heading: false + show_root_toc_entry: false + +It inherits from [`OptionList`][textual.widgets.OptionList] +and so also inherits the following bindings: + +::: textual.widgets.OptionList.BINDINGS + options: + show_root_heading: false + show_root_toc_entry: false + +## Component Classes + +The selection list provides the following component classes: + +::: textual.widgets.SelectionList.COMPONENT_CLASSES + options: + show_root_heading: false + show_root_toc_entry: false + +It inherits from [`OptionList`][textual.widgets.OptionList] and so also +makes use of the following component classes: + +::: textual.widgets.OptionList.COMPONENT_CLASSES + options: + show_root_heading: false + show_root_toc_entry: false + +::: textual.widgets.SelectionList + options: + heading_level: 2 + +::: textual.widgets.selection_list.Selection + options: + heading_level: 2 + +::: textual.widgets.selection_list + options: + heading_level: 2 diff --git a/mkdocs-nav.yml b/mkdocs-nav.yml index f5a9ab4f1..3be215180 100644 --- a/mkdocs-nav.yml +++ b/mkdocs-nav.yml @@ -150,6 +150,7 @@ nav: - "widgets/radiobutton.md" - "widgets/radioset.md" - "widgets/select.md" + - "widgets/selection_list.md" - "widgets/static.md" - "widgets/switch.md" - "widgets/tabbed_content.md"