Button

fun Button(label: String, onClick: () -> Unit, modifier: Modifier = Modifier, iconPainter: Painter? = null, isEnabled: Boolean = true, buttonType: ButtonType = ButtonType.Primary, buttonSize: ButtonSize = ButtonSize.LargeProductive, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Button

Buttons are used to initialize an action. Button labels express what action will occur when the user interacts with it.

Overview

Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.

When to use

Use buttons to communicate actions users can take and to allow users to interact with the page. Each page should have only one primary button, and any remaining calls to action should be represented as lower emphasis buttons.

When not to use

Do not use buttons as navigational elements. Instead, use links when the desired action is to take the user to a new page.

(From Button documentation)

Parameters

label

The text to be displayed in the button.

onClick

Callback invoked when the button is clicked.

modifier

The modifier to be applied to the button.

iconPainter

Icon painter to be displayed in the button.

isEnabled

Whether the button is enabled or disabled.

buttonType

A ButtonType that defines the button's type.

buttonSize

A ButtonSize that defines the button's size.

interactionSource

The MutableInteractionSource that keeps track of the button's state.