mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Extend add_option so that it accepts selections and selection tuples
This commit is contained in:
@@ -448,3 +448,12 @@ class SelectionList(Generic[SelectionType], OptionList):
|
|||||||
"Only Selection or a prompt/value tuple is supported in SelectionList"
|
"Only Selection or a prompt/value tuple is supported in SelectionList"
|
||||||
)
|
)
|
||||||
return super().add_options(cleaned_options)
|
return super().add_options(cleaned_options)
|
||||||
|
|
||||||
|
def add_option(
|
||||||
|
self,
|
||||||
|
item: NewOptionListContent
|
||||||
|
| Selection
|
||||||
|
| tuple[TextType, SelectionType]
|
||||||
|
| tuple[TextType, SelectionType, bool] = None,
|
||||||
|
) -> Self:
|
||||||
|
return self.add_options([item])
|
||||||
|
|||||||
Reference in New Issue
Block a user