Button

Button

A customizable button component that supports different variants, states, and styles.


Installation

./gradlew lumo --add Button

Usage

Basic Example

// Primary button
Button(
    text = "Primary",
    variant = ButtonVariant.Primary,
    onClick = { /* handle click */ }
)
 
// Outlined button
Button(
    text = "Outlined",
    variant = ButtonVariant.PrimaryOutlined,
    onClick = { /* handle click */ }
)
 

Button With Content

Button(
    variant = ButtonVariant.Primary,
    onClick = { /* handle click */ }
){
    Row {
        Icon(Icons.Default.Star, "Favorites")
        Text("Favorites")
    }
}

ButtonVariant

Button(
    variant = ButtonVariant.PrimaryOutlined,
    onClick = { /* handle click */ }
){
    Text("Click me!")
}

Button variants control the visual appearance of buttons by applying different combinations of colors, borders, and effects. Each variant is designed for specific use cases:

  • Filled variants use solid background colors
  • Outlined variants use borders
  • Elevated variants add shadows and solid background colors
  • Ghost variants are subtle with only colored content
TypeVariantDescription
FilledPrimarySolid background with primary brand color
SecondarySolid background with secondary color
DestructiveSolid background with error color
OutlinedPrimaryOutlinedPrimary color border and text
SecondaryOutlinedSecondary color border and text
DestructiveOutlinedError color border and text
ElevatedPrimaryElevatedPrimary color with drop shadow
SecondaryElevatedSecondary color with drop shadow
DestructiveElevatedError color with drop shadow
GhostPrimaryGhostSubtle primary colored text
SecondaryGhostSubtle secondary colored text
DestructiveGhostSubtle error colored text
GhostTransparent with LocalContentColor text color

API Documentation

Button

The Button composable creates a clickable button with various styles and states.

Parameters

ParameterTypeDescription
modifierModifierModifier for the button
textString?Text to display in the button
enabledBooleanWhether the button is enabled
loadingBooleanWhether to show loading state
variantButtonVariantStyle variant of the button
onClick() -> UnitCallback when button is clicked
contentPaddingPaddingValuesPadding around button content
interactionSourceMutableInteractionSourceHandles button interactions
content@Composable (() -> Unit)?Optional custom content instead of text