API reference

Button Composable

Displays a push button with arbitrary composable content.
Use LabelButton or IconButton for common content. Use this foundation when a button needs a custom arrangement while retaining UISet interaction behavior and theming.

Signature

@Composable
fun Button(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    style: ButtonStyle = ButtonStyle.Primary,
    enabled: Boolean = true,
    expanded: Boolean = false,
    dimensions: ButtonDimensions = UiSetTheme.dimensions.buttons,
    shape: Shape = UiSetTheme.shapes.button,
    contentPadding: PaddingValues = PaddingValues(horizontal = dimensions.horizontalPadding),
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    indication: UiSetIndicationSpec? =
        UiSetTheme.indications.standard.forContext(style.interactionColorContext),
    contentAlignment: Alignment = Alignment.Center,
    content: @Composable BoxScope.() -> Unit,
)

Parameters

onClick: () -> Unit callback invoked when the button is activated
modifier: Modifier modifier applied to the full interaction target
style: ButtonStyle semantic button colors and border treatment
enabled: Boolean whether the button accepts input
expanded: Boolean whether the button fills its available width
dimensions: ButtonDimensions visual height, padding, icon, and border values
shape: Shape clipping, background, and border shape
contentPadding: PaddingValues padding between the visual container and content
interactionSource: MutableInteractionSource interaction stream shared with callers observing button state
indication: UiSetIndicationSpec? press, hover, and focus indication drawn inside the visual container
contentAlignment: Alignment alignment of content within the button
content: @Composable BoxScope.() -> Unit arbitrary button content