Toggles
Togglesanimated

Neon Glow

Dark switch pulsing a neon-cyan thumb wrapped in a glowing ring.

Installation

caveui components are copy-paste Jetpack Compose built entirely on Material 3 — there's no caveui dependency to add. Make sure Material 3 is on your classpath (it ships with the Compose BOM), then copy the Usage snippet below into your project.

kotlin
// build.gradle.kts (module)
dependencies {
    implementation(platform("androidx.compose:compose-bom:2025.06.00"))
    implementation("androidx.compose.material3:material3")
}

Usage

kotlin
@Composable
fun NeonGlowToggle() {
  var on by remember { mutableStateOf(true) }
  val glow by animateDpAsState(
    targetValue = if (on) 12.dp else 0.dp,
    animationSpec = tween(400),
  )
  val cyan = Color(0xFF22D3EE)
  Box(
    modifier = Modifier
      .width(52.dp)
      .height(32.dp)
      .clip(CircleShape)
      .background(Color(0xFF0F172A)),
    contentAlignment = Alignment.CenterEnd,
  ) {
    Box(
      modifier = Modifier
        .padding(4.dp)
        .size(24.dp)
        .shadow(
          elevation = glow,
          shape = CircleShape,
          ambientColor = cyan,
          spotColor = cyan,
        )
        .clip(CircleShape)
        .background(cyan)
        .clickable { on = !on },
    )
  }
}