Tooltip
A tooltip that is shown when you hover above an element.
@solara.component
def Tooltip(
tooltip: Union[str, solara.Element],
children=[],
color: Optional[str] = None,
):
...
Not all components support tooltips, in case it does not work,
try wrapping the element in a Column
or Row
.
import solara
@solara.component
def Page():
with solara.Tooltip("This is a tooltip over a button"):
solara.Button("Hover me")
with solara.Tooltip("This is a tooltip over a text"):
solara.Text("Hover me")
info = solara.Info("Any component is supported as tooltip.")
with solara.Tooltip(info, color="white"):
with solara.Column():
solara.Markdown("# Lorem ipsum\n\nDolor sit amet")
Hover me
Lorem ipsum
Dolor sit amet
Live output
Arguments
tooltip
: the text, or element to display on hover.children
: the element to display the tooltip over.color
: the color of the tooltip (if None, the default color).