Checkbox
A component that allows users to select one or more options.
Properties
Preview
Generated Code
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Checkbox
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun MyCheckbox() {
var checked by remember { mutableStateOf(false) }
Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(
checked = checked,
onCheckedChange = { checked = it },
enabled = true
)
Text(
text = "Accept terms",
modifier = Modifier.padding(start = 8.dp)
)
}
}