Cards
Cardsanimated

Smart Bulb Brightness

Dimmable bulb tile with a vertical brightness slider and animated glow.

Bedroom Lamp

70%

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 BulbBrightnessCard() {
  var level by remember { mutableFloatStateOf(0.7f) }
  val glow by animateFloatAsState(level, label = "glow")
  ElevatedCard(Modifier.fillMaxWidth()) {
    Row(
      Modifier.padding(20.dp),
      verticalAlignment = Alignment.CenterVertically
    ) {
      Canvas(Modifier.size(64.dp)) {
        drawCircle(
          Color(0xFFFFCC00).copy(alpha = 0.15f + glow * 0.4f),
          radius = size.minDimension / 2
        )
        drawCircle(
          Color(0xFFFFCC00).copy(alpha = 0.4f + glow * 0.6f),
          radius = size.minDimension / 4
        )
      }
      Spacer(Modifier.width(18.dp))
      Column(Modifier.weight(1f)) {
        Text(
          "Bedroom Lamp",
          style = MaterialTheme.typography.titleMedium
        )
        Text(
          "${(level * 100).toInt()}%",
          style = MaterialTheme.typography.labelMedium,
          color = MaterialTheme.colorScheme
            .onSurfaceVariant
        )
        Slider(
          value = level,
          onValueChange = { level = it }
        )
      }
    }
  }
}