Extra
DonutChart
A FormaUI donut chart — proportional stroked arc segments around an open center slot, drawn with pure Compose Canvas (no chart-library dependency); segments cycle the shared series palette and sweep in clockwise on entry.
dev.formaui.components.chart
Preview
This toggle is site chrome only — the preview has its own light/dark switch inside.
Live preview
Live preview — ~37 MB development build
Usage
FormaDonutChart(
entries = listOf(
FormaChartEntry("Rent", 850f),
FormaChartEntry("Groceries", 420f),
FormaChartEntry("Transport", 210f),
),
centerContent = { Text("1480") },
)FormaDonutChart
Proportional arc segments separated by small gaps around an open center, cycling FormaChartDefaults.seriesColors, with a centerContent slot (e.g. a total) and an auto-generated percentage summary as its content description; empty or all-zero data draws a neutral track ring instead of crashing.
Supporting API
- FormaChartEntrydata class
- The shared chart data point — see the bar-chart entry for the full shared chart API (FormaChartEntry, FormaChartDefaults, FormaChartLegend).
Accessibility
Exposes an auto-generated integer-percentage summary (e.g. "Donut chart with 3 segments. Rent: 57 percent. …") as its semantics content description — override with contentDescription; empty entries describe themselves as "Donut chart with no data", and the centerContent slot's semantics stay independently accessible.