Compose Component

Button

Button is a component used for exposing actions to a user.

ButtonSample

@Sampled
@Composable
fun ButtonSample() {
    Button(onClick = {}) { Text("Send") }
}

ButtonWithLeadingIconSample

@Sampled
@Composable
fun ButtonWithLeadingIconSample() {
    Button(onClick = {}, leadingIcon = { Icon(FavoriteIcon, "Localized description") }) {
        Text("Send")
    }
}

LargeButtonSample

@Sampled
@Composable
fun LargeButtonSample() {
    Button(onClick = {}, buttonSize = ButtonSize.Large) { Text("Send") }
}

CustomFocusedColorButtonSample

@Sampled
@Composable
fun CustomFocusedColorButtonSample() {
    Button(
        onClick = {},
        focusedColor = ButtonDefaults.focusedColor(Color(0xFF34E0A1)),
    ) {
        Text("Button with custom colors")
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: