How to add elevation to button? What to import?
@Composable
fun MyUi() {
Column() {
Button(onClick = { }) {
Text(text = "Lorem")
}
}
}
To add elevation in your Button
composable, you can pass values to the elevation
parameter. You can modify your code like below:
@Composable
fun MyUi() {
Column() {
Button(
onClick = { },
elevation = ButtonDefaults.buttonElevation(
defaultElevation = 10.dp
)
) {
Text(text = "Lorem")
}
}
}
Import ButtonDefaults
object from androidx.compose.material3.ButtonDefaults
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With