Checkbox
Basic Example
The on_change trigger is called when the checkbox is clicked.
false
The input prop is used to set the checkbox as a controlled component.
Example Form
Results:
{}ExpandCollapse
API Reference
rx.checkbox
A checkbox component with a label.
sizevariantcolor_schemehigh_contrastdisabledProps
| Prop | Type | Description |
|---|---|---|
text | str | The text label for the checkbox. |
spacing | "0""1""2""3""4""5""6""7""8""9" | The gap between the checkbox and the label. |
size | "1""2""3" | The size of the checkbox "1" - "3". |
as_child | bool | Change the default rendered element for the one passed as a child, merging their props and behavior. |
variant | "classic""surface""soft" | Variant of checkbox: "classic" | "surface" | "soft". |
color_scheme | "tomato""red""ruby""crimson""pink""plum""purple""violet""iris""indigo""blue""cyan""teal""jade""green""grass""brown""orange""sky""mint""lime""yellow""amber""gold""bronze""gray" | Override theme color for checkbox. |
high_contrast | bool | Whether to render the checkbox with higher contrast color against background. |
default_checked | bool | Whether the checkbox is checked by default. |
checked | bool | Whether the checkbox is checked. |
disabled | bool | Whether the checkbox is disabled. |
required | bool | Whether the checkbox is required. |
name | str | The name of the checkbox control when submitting the form. |
value | str | The value of the checkbox control when submitting the form. |