Cards
Cardsanimated

Revenue Area

A filled area chart sweeps under a revenue headline and growth chip.

Revenue
$48,290

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 RevenueAreaCard() {
  val pts = listOf(0.4f, 0.55f, 0.45f, 0.7f, 0.65f, 0.85f)
  val grow = remember { Animatable(0f) }
  LaunchedEffect(Unit) {
    grow.animateTo(1f, tween(1100, easing = FastOutSlowInEasing))
  }
  ElevatedCard(
    shape = RoundedCornerShape(20.dp),
    modifier = Modifier.width(260.dp),
  ) {
    Column {
      Column(Modifier.padding(18.dp)) {
        Text(
          text = "Revenue",
          style = MaterialTheme.typography.labelMedium,
          color = MaterialTheme.colorScheme.onSurfaceVariant,
        )
        Text(
          text = "$48,290",
          style = MaterialTheme.typography.headlineSmall,
          fontWeight = FontWeight.Bold,
        )
      }
      Canvas(
        Modifier
          .fillMaxWidth()
          .height(64.dp),
      ) {
        val step = size.width / (pts.size - 1)
        val path = Path().apply { moveTo(0f, size.height) }
        pts.forEachIndexed { i, p ->
          path.lineTo(i * step, size.height * (1f - p * grow.value))
        }
        path.lineTo(size.width, size.height)
        path.close()
        drawPath(
          path = path,
          brush = Brush.verticalGradient(
            listOf(
              Color(0xFF06B6D4).copy(alpha = 0.5f),
              Color(0xFF06B6D4).copy(alpha = 0f),
            ),
          ),
        )
      }
    }
  }
}