Created
May 9, 2024 15:09
-
-
Save aritra-tech/db5b32758d01a702143b431e3e40f5ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ToggleChipExample() { | |
var checked by remember { mutableStateOf(true) } | |
ToggleChip( | |
modifier = Modifier.fillMaxWidth(), | |
label = { | |
Text("Dark Mode") | |
}, | |
checked = checked, | |
colors = ToggleChipDefaults.toggleChipColors( | |
uncheckedToggleControlColor = ToggleChipDefaults.SwitchUncheckedIconColor | |
), | |
toggleControl = { | |
Switch( | |
checked = checked, | |
enabled = true, | |
modifier = Modifier.semantics { | |
this.contentDescription = | |
if (checked) "On" else "Off" | |
} | |
) | |
}, | |
onCheckedChange = { checked = it }, | |
enabled = true, | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment