Property

LocalRippleThemeConfiguration

The overall RippleThemeConfiguration in use by all built-in components and ripple.

EnableInsetFocusRingSample

@Sampled
@Composable
fun EnableInsetFocusRingSample() {
    // Enable inset focus rings through the theme configuration.
    CompositionLocalProvider(
        LocalRippleThemeConfiguration provides RippleDefaults.InsetFocusRingThemeConfiguration
    ) {
        // Button is a standard Wear Material3 component that supports focus rings internally.
        Button(onClick = { /* Do something */ }, label = { Text("Button") })
    }
}

CustomizeInsetFocusRingSample

@Sampled
@Composable
fun CustomizeInsetFocusRingSample() {
    // Customize the focus ring stroke sizes through the theme configuration.
    CompositionLocalProvider(
        LocalRippleThemeConfiguration provides
            RippleThemeConfiguration(
                RippleThemeConfiguration.Focus.InsetRing(
                    outerStrokeInset = 0.dp,
                    outerStrokeWidth = 3.dp,
                    innerStrokeInset = 0.dp,
                    innerStrokeWidth = 6.dp,
                )
            )
    ) {
        Column(
            modifier = Modifier.fillMaxSize(),
            verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterVertically),
            horizontalAlignment = Alignment.CenterHorizontally,
        ) {
            // Button is a standard Wear Material3 component that supports focus rings internally.
            Button(onClick = { /* Do something */ }, label = { Text("Button") })

            // SwitchButton is also a standard component that supports focus rings internally.
            // We override its focus ring colors here.
            CompositionLocalProvider(
                LocalRippleConfiguration provides
                    RippleConfiguration(
                        focus =
                            RippleConfiguration.Focus.InsetRing(
                                outerStrokeColor = MaterialTheme.colorScheme.tertiary,
                                innerStrokeColor = MaterialTheme.colorScheme.onTertiary,
                            )
                    )
            ) {
                SwitchButton(
                    checked = true,
                    onCheckedChange = { /* Do something */ },
                    label = { Text("SwitchButton") },
                )
            }
        }
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: