Button
A button that can be clicked to trigger an event.
@solara.component
def Button(
label: str = None,
on_click: Callable[[], None] = None,
icon_name: str = None,
children: list = [],
disabled=False,
text=False,
outlined=False,
color: Optional[str] = None,
click_event="click",
classes: List[str] = [],
style: Union[str, Dict[str, str], None] = None,
value=None,
**kwargs,
):
...
Example
import solara
@solara.component
def Page():
with solara.Row():
solara.Button(label="Default")
solara.Button(label="Default+color", color="primary")
solara.Button(label="Text", text=True)
solara.Button(label="Outlined", outlined=True)
solara.Button(label="Outlined+color", outlined=True, color="primary")
Live output
Arguments
label: The text to display on the button.on_click: A callback function that is called when the button is clicked.icon_name: The name of the icon to display on the button (Overview of available icons).children: A list of child elements to display on the button.disabled: Whether the button is disabled.text: Whether the button should be displayed as text, it has no shadow and no background.outlined: Whether the button should be displayed as outlined, it has no background.value: (Optional) When used as a child of a ToggleButtons component, the value of the selected button, see ToggleButtons.classes: Additional CSS classes to apply.style: CSS style to apply.
Deprecated arguments
- click_event: (Deprecated/export option: The event that triggers the on_click callback, which can include vue event modifiers).
Example