# Switch

> Switch from Material 3 Compose (`androidx.compose.material3:material3`) for Jetpack Compose, with a code sample.

- Library: [Material 3 Compose](https://composables.com/material-components/material-3-compose.md)
- Category: [Switches](https://composables.com/material-components/switches.md)
- API reference and more examples: [Switch](https://composables.com/jetpack-compose/androidx.compose.material3/material3/components/Switch/api.md)

## Code

```kotlin
@Composable
fun SwitchSample() {
    var checked by rememberSaveable { mutableStateOf(true) }
    Switch(
        modifier = Modifier.semantics { contentDescription = "Demo" },
        checked = checked,
        onCheckedChange = { checked = it },
    )
}
```
