Icons
Iconsanimated
Power
A power button whose ring sweeps closed around the stem with a soft glow when energised.
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 PowerToggle(on: Boolean, onToggle: () -> Unit) {
val p by animateFloatAsState(if (on) 1f else 0f, tween(500, easing = EaseInOutCubic), label = "pwr")
val color = if (on) Color(0xFF16A34A) else LocalContentColor.current
Canvas(Modifier.size(40.dp).clickable(onClick = onToggle)) {
val s = Stroke(3.dp.toPx(), cap = StrokeCap.Round)
drawArc(color, -60f, 300f * p, false, style = s,
topLeft = Offset(size.width * 0.18f, size.height * 0.18f), size = Size(size.width * 0.64f, size.height * 0.64f))
drawLine(color, Offset(center.x, size.height * 0.18f), Offset(center.x, size.height * 0.42f), s.width, StrokeCap.Round)
}
}