Skip to content
🤔 Documentation issue? Report or edit

Button

A Button has a onClick-Function. You can add a Text-Composable or any other Composables as child elements of the Button.

@Composable
fun ButtonExample() {
    Button(onClick = { /* Do something! */ }, colors = ButtonDefaults.textButtonColors(
        backgroundColor = Color.Red
    )) {
        Text("Button")
    }
}

OutlinedButton

@Composable
fun OutlinedButtonExample() {
    OutlinedButton(onClick = { /* Do something! */ }) {
       Text("I'm an Outlined Button")
   }
}

TextButton

@Composable
fun TextButtonExample() {
    TextButton(onClick = { /* Do something! */ }) {
        Text("I'm a Text Button")
    }
}

See also:


Last update: July 27, 2022