Charts
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 PieChart(
slices: List<Pair<Float, Color>> = listOf(
0.35f to Color(0xFF6366F1), 0.25f to Color(0xFF22D3EE),
0.22f to Color(0xFFF59E0B), 0.18f to Color(0xFFF43F5E),
),
modifier: Modifier = Modifier,
) {
val sweep by animateFloatAsState(1f, tween(1000, easing = EaseOutCubic), label = "s")
Canvas(modifier.size(140.dp)) {
var start = -90f
slices.forEach { (frac, color) ->
val deg = 360f * frac
drawArc(color, start, deg * sweep, useCenter = true)
start += deg
}
}
}