@Composable fun Test( selected: Int, index: Int, onSelectedItemChange: (Int) -> Unit, ) { val brush = Brush.animateAsState( colorList1 = listOf(Orange, Pink), colorList2 = listOf(Blue, DarkBlue), targetValue = selected == index, ) Box( Modifier .fillMaxWidth() .padding(8.dp) .border(2.dp, brush.reverse, RoundedCornerShape(16.dp)) .clip(RoundedCornerShape(16.dp)) .background(brush.brush) .clickable { onSelectedItemChange(index) } .height(56.dp), Alignment.Center) { Text( text = "item $index", modifier = Modifier.foregroundBrush(brush.reverse), style = mTitleMediumSemiBold ) } }