77
88from typing import TYPE_CHECKING , ClassVar
99
10+ from rich .console import RenderableType
1011from rich .style import Style
1112from rich .text import Text , TextType
1213
@@ -130,6 +131,7 @@ def __init__(
130131 id : str | None = None ,
131132 classes : str | None = None ,
132133 disabled : bool = False ,
134+ tooltip : RenderableType | None = None ,
133135 ) -> None :
134136 """Initialise the toggle.
135137
@@ -141,13 +143,16 @@ def __init__(
141143 id: The ID of the toggle in the DOM.
142144 classes: The CSS classes of the toggle.
143145 disabled: Whether the button is disabled or not.
146+ tooltip: RenderableType | None = None,
144147 """
145148 super ().__init__ (name = name , id = id , classes = classes , disabled = disabled )
146149 self ._button_first = button_first
147150 # NOTE: Don't send a Changed message in response to the initial set.
148151 with self .prevent (self .Changed ):
149152 self .value = value
150153 self ._label = self ._make_label (label )
154+ if tooltip is not None :
155+ self .tooltip = tooltip
151156
152157 def _make_label (self , label : TextType ) -> Text :
153158 """Make a `Text` label from a `TextType` value.
0 commit comments