mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add some default styling to the toggle button classes
This won't be the final form, I feel this is a good point to start to think about making standard styles for this sort of thing in Textual, but this here helps me see what's going on.
This commit is contained in:
@@ -15,7 +15,7 @@ from ..reactive import reactive
|
|||||||
from ._static import Static
|
from ._static import Static
|
||||||
|
|
||||||
|
|
||||||
class ToggleButton(Static):
|
class ToggleButton(Static, can_focus=True):
|
||||||
"""Base toggle button widget."""
|
"""Base toggle button widget."""
|
||||||
|
|
||||||
BINDINGS: ClassVar[list[BindingType]] = [
|
BINDINGS: ClassVar[list[BindingType]] = [
|
||||||
@@ -27,6 +27,18 @@ class ToggleButton(Static):
|
|||||||
| enter,space | Toggle the value. |
|
| enter,space | Toggle the value. |
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
DEFAULT_CSS = """
|
||||||
|
ToggleButton:hover {
|
||||||
|
text-style: bold;
|
||||||
|
background: $boost;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToggleButton:focus {
|
||||||
|
color: $text;
|
||||||
|
background: $secondary;
|
||||||
|
}
|
||||||
|
""" # TODO: https://github.com/Textualize/textual/issues/1780
|
||||||
|
|
||||||
button_prefix: reactive[TextType] = reactive[TextType]("[")
|
button_prefix: reactive[TextType] = reactive[TextType]("[")
|
||||||
"""The character for the left side of the toggle button."""
|
"""The character for the left side of the toggle button."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user