mo.ui.checkbox
Create a checkbox for boolean input.
Signature
mo.ui.checkbox(
value: bool = False,
*,
label: str = "",
disabled: bool = False,
on_change: Callable[[bool], None] | None = None
)
Parameters
Markdown label for the checkbox
Whether the checkbox is disabled
Examples
import marimo as mo
# Basic checkbox
agree = mo.ui.checkbox(label="I agree to the terms")
agree
# Use the value
if agree.value:
mo.md("Thank you for agreeing!")
# Multiple checkboxes
options = mo.md(
f"""
Select your preferences:
{mo.ui.checkbox(label="Email notifications")}
{mo.ui.checkbox(label="SMS alerts")}
{mo.ui.checkbox(label="Newsletter")}
"""
)