← Back to Wear Material Core
Checkbox
Overview
Code Examples
Checkbox provides an animated checkbox for use in material APIs.
@param checked Boolean flag indicating whether this checkbox is currently checked. @param modifier Modifier to be applied to the checkbox. This can be used to provide a content description for accessibility. @param boxColor Composable lambda from which the box color will be obtained. @param checkmarkColor Composable lambda from which the check mark color will be obtained. @param enabled Boolean flag indicating the enabled state of the Checkbox (affects the color). @param onCheckedChange Callback to be invoked when Checkbox is clicked. If null, then this is passive and relies entirely on a higher-level component to control the state. @param interactionSource When also providing onCheckedChange, the MutableInteractionSource representing the stream of Interactions for the "toggleable" tap area - can be used to customise the appearance / behavior of the Checkbox. @param progressAnimationSpec Animation spec to animate the progress. @param drawBox Draws the checkbox. @param width Width of the checkbox. @param height Height of the checkbox.
Overloads
Checkbox
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Composable
fun Checkbox(
checked: Boolean,
modifier: Modifier = Modifier,
boxColor: @Composable (enabled: Boolean, checked: Boolean) -> State<Color>,
checkmarkColor: @Composable (enabled: Boolean, checked: Boolean) -> State<Color>,
enabled: Boolean,
onCheckedChange: ((Boolean) -> Unit)?,
interactionSource: MutableInteractionSource,
progressAnimationSpec: TweenSpec<Float>,
drawBox: FunctionDrawBox,
width: Dp,
height: Dp
)
Parameters
Name | Description |
---|---|
checked | Boolean flag indicating whether this checkbox is currently checked. |
modifier | Modifier to be applied to the checkbox. This can be used to provide a content description for accessibility. |
boxColor | Composable lambda from which the box color will be obtained. |
checkmarkColor | Composable lambda from which the check mark color will be obtained. |
enabled | Boolean flag indicating the enabled state of the Checkbox (affects the color). |
onCheckedChange | Callback to be invoked when Checkbox is clicked. If null, then this is passive and relies entirely on a higher-level component to control the state. |
interactionSource | When also providing onCheckedChange, the MutableInteractionSource representing the stream of Interactions for the "toggleable" tap area - can be used to customise the appearance / behavior of the Checkbox. |
progressAnimationSpec | Animation spec to animate the progress. |
drawBox | Draws the checkbox. |
width | Width of the checkbox. |
height | Height of the checkbox |