← Back to Wear Material Core
Button
Overview
Examples
Community Notes
Video
Wear Material Button that offers a single slot to take any content (text, icon or image).
Button can be enabled or disabled. A disabled button will not respond to click events.
For more information, see the Buttons(https://developer.android.com/training/wearables/components/buttons) guide.
@param onClick Will be called when the user clicks the button. @param modifier Modifier to be applied to the button. @param enabled Controls the enabled state of the button. When false
, this button will not be clickable. @param backgroundColor Resolves the background for this button in different states. @param interactionSource The 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. @param shape Defines the button's shape. @param border Resolves the border for this button in different states. @param buttonSize The default size of the button unless overridden by Modifier.size. @param content The content displayed on the Button such as text, icon or image.
Overloads
Button
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Composable
fun Button(
onClick: () -> Unit,
modifier: Modifier,
enabled: Boolean,
backgroundColor: @Composable (enabled: Boolean) -> State<Color>,
interactionSource: MutableInteractionSource,
shape: Shape,
border: @Composable (enabled: Boolean) -> State<BorderStroke?>?,
buttonSize: Dp,
content: @Composable BoxScope.() -> Unit,
)
Parameters
Name | Description |
---|---|
onClick | Will be called when the user clicks the button. |
modifier | Modifier to be applied to the button. |
enabled | Controls the enabled state of the button. When false , this button will not be clickable. |
backgroundColor | Resolves the background for this button in different states. |
interactionSource | The 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. |
shape | Defines the button's shape. |
border | Resolves the border for this button in different states. |
buttonSize | The default size of the button unless overridden by Modifier.size. |
content | The content displayed on the Button such as text, icon or image |