Button

Composable Component

Wear Material Button that offers a single slot to take any content (text, icon or image).

Android

Deprecated This overload is provided for backwards compatibility with Compose for Wear OS 1.0.A newer overload is available with an additional shape parameter.

@Composable
public fun Button(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    colors: ButtonColors = ButtonDefaults.primaryButtonColors(),
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    content: @Composable BoxScope.() -> Unit,
): Unit

Parameters

onClickWill be called when the user clicks the button.
modifierModifier to be applied to the button.
enabledControls the enabled state of the button. When false, this button will not be clickable.
colorsButtonColors that will be used to resolve the background and content color for this button in different states. See ButtonDefaults.buttonColors.
interactionSourceThe MutableInteractionSource representing the stream of Interactions for this Button. You can create and pass in your own remembered MutableInteractionSource if you want to observe Interactions and customize the appearance / behavior of this Button in different Interactions.
contentThe content displayed on the Button such as text, icon or image.
Android
@Composable
public fun Button(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    colors: ButtonColors = ButtonDefaults.primaryButtonColors(),
    interactionSource: MutableInteractionSource? = null,
    shape: Shape = CircleShape,
    border: ButtonBorder = ButtonDefaults.buttonBorder(),
    content: @Composable BoxScope.() -> Unit,
)

Parameters

onClickWill be called when the user clicks the button.
modifierModifier to be applied to the button.
enabledControls the enabled state of the button. When false, this button will not be clickable.
colorsButtonColors that will be used to resolve the background and content color for this button in different states. See ButtonDefaults.buttonColors.
interactionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.
shapeDefines the button's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme.
borderButtonBorder that will be used to resolve the button border in different states. See ButtonDefaults.buttonBorder.
contentThe content displayed on the Button such as text, icon or image.