Checkbox
A 24 dp rounded square toggle with animated color transitions, a disabled state, and full color customization via CheckboxDefaults.
Checkbox renders a 24 dp square with a sm corner radius. Background, border, and checkmark colors all animate over 100 ms when the state changes. When pressed, the border briefly switches to the theme's ring color as a focus indicator.
Basic usage
Disabled
Set enabled = false to prevent interaction. The component renders with the theme's muted background and ignores taps.
Custom colors
Override any color token via CheckboxDefaults.colors().copy(...). The example below wires border and fill colors to state so the surrounding card also reacts to the checked value.
API reference
Checkbox
| Parameter | Type | Default | Description |
|---|---|---|---|
checked | Boolean | — | Whether the checkbox is currently checked. |
onCheckedChange | ((Boolean) -> Unit)? | — | Called with the new value when the user toggles. Pass null to make the checkbox non-interactive while still rendering state. |
modifier | Modifier | Modifier | Applied to the 24 dp box. |
enabled | Boolean | true | When false, the checkbox ignores input and renders with the muted color. |
colors | CheckboxColors | CheckboxDefaults.colors() | Color tokens for each visual state. |
CheckboxColors
| Field | Type | Description |
|---|---|---|
checkedColor | Color | Background when checked. |
uncheckedColor | Color | Background when unchecked. Defaults to Color.Transparent. |
disabledColor | Color | Background when disabled. |
checkedCheckmarkColor | Color | Check icon tint when checked. |
uncheckedCheckmarkColor | Color | Check icon tint when unchecked. Defaults to Color.Transparent. |
disabledCheckmarkColor | Color | Check icon tint when disabled. |
checkedBorderColor | Color | Border color when checked. |
uncheckedBorderColor | Color | Border color when unchecked. |
CheckboxDefaults
| Member | Description |
|---|---|
colors() | Returns a CheckboxColors using primary for checked states, input for the unchecked border, and muted for the disabled background. |