Typing for label variants

This commit is contained in:
Darren Burns
2024-11-07 12:00:45 +00:00
parent d78af48b29
commit 1d21101c52

View File

@@ -1,9 +1,13 @@
"""Provides a simple Label widget."""
from typing import Literal
from rich.console import RenderableType
from textual.widgets._static import Static
LabelVariant = Literal["success", "error", "warning", "primary", "secondary", "accent"]
class Label(Static):
"""A simple label widget for displaying text-oriented renderables."""
@@ -45,7 +49,7 @@ class Label(Static):
self,
renderable: RenderableType = "",
*,
variant: str | None = None,
variant: LabelVariant | None = None,
expand: bool = False,
shrink: bool = False,
markup: bool = True,