Cards
Cardsanimated
Currency Converter
Converter card with two amount fields and a rotating swap action button.
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 CurrencyConverterCard() {
var swapped by remember { mutableStateOf(false) }
val rot by animateFloatAsState(
if (swapped) 180f else 0f, label = "rot"
)
OutlinedCard(
modifier = Modifier.fillMaxWidth().padding(16.dp),
shape = RoundedCornerShape(20.dp)
) {
Column(Modifier.padding(18.dp)) {
Row(Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically) {
Text("USD", Modifier.weight(1f),
color = MaterialTheme.colorScheme.onSurfaceVariant)
Text("100.00", fontWeight = FontWeight.SemiBold)
}
Spacer(Modifier.height(8.dp))
IconButton(
onClick = { swapped = !swapped },
modifier = Modifier
.align(Alignment.CenterHorizontally)
.graphicsLayer { rotationZ = rot }
) {
Icon(Icons.Filled.ArrowDownRight, null,
tint = MaterialTheme.colorScheme.primary)
}
Spacer(Modifier.height(8.dp))
Row(Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically) {
Text("EUR", Modifier.weight(1f),
color = MaterialTheme.colorScheme.onSurfaceVariant)
Text("92.13", fontWeight = FontWeight.SemiBold)
}
}
}
}