Composable Function

RemoteButton

Base level Wear Material3 RemoteButton that offers a single slot to take any content.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

RemoteButton

Android
@Composable
@RemoteComposable
public fun RemoteButton(
    onClick: Action,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    colors: RemoteButtonColors = RemoteButtonDefaults.buttonColors(),
    shape: RemoteShape = RemoteButtonDefaults.shape,
    contentPadding: RemotePaddingValues = RemoteButtonDefaults.ContentPadding,
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    content: @Composable @RemoteComposable RemoteRowScope.() -> Unit,
)

Base level Wear Material3 RemoteButton that offers a single slot to take any content. Used as the container for more opinionated RemoteButton components that take specific content such as icons and labels.

RemoteButton takes the RemoteButtonDefaults.buttonColors color scheme by default, with colored background, contrasting content color and no border. This is a high-emphasis button for the primary, most important or most common action on a screen.

Button can be enabled or disabled. A disabled button will not respond to click events.

Parameters

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. It must be a constant value.
shape Defines the button's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material3 Theme
colors RemoteButtonColors that will be used to resolve the background and content color for this button in different states. See RemoteButtonDefaults.buttonColors.
border Optional RemoteDp that will be used to resolve the border for this button in different states.
borderColor Optional RemoteColor that will be used to resolve the border color for this button in different states.
contentPadding The spacing values to apply internally between the container and the content
content Slot for composable body content displayed on the Button

RemoteButton

Android
@Composable
@RemoteComposable
public fun RemoteButton(
    onClick: Action,
    containerPainter: RemotePainter,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    disabledContainerPainter: RemotePainter =
        RemoteButtonDefaults.disabledContainerPainter(containerPainter),
    colors: RemoteButtonColors =
        RemoteButtonDefaults.buttonWithNullableContainerPainterColors(containerPainter),
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    shape: RemoteShape = RemoteButtonDefaults.shape,
    contentPadding: RemotePaddingValues = RemoteButtonDefaults.ContentPadding,
    content: @Composable @RemoteComposable RemoteRowScope.() -> Unit,
)

Base level Wear Material3 RemoteButton that offers parameters for container image backgrounds, with a single slot to take any content.

An Image background is a means to reinforce the meaning of information in a Button. Buttons should have a content color that contrasts with the background image and scrim.

RemoteButton can be enabled or disabled. A disabled button will not respond to click events.

Parameters

onClick Will be called when the user clicks the button
containerPainter The background image of this RemoteButton when enabled
modifier Modifier to be applied to the button
enabled Controls the enabled state of the button. When false, this button will not be clickable. It must be a constant value.
disabledContainerPainter The background image of this RemoteButton when disabled
shape Defines the button's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material3 Theme
colors RemoteButtonColors that will be used to resolve the background and content color for this button in different states. See RemoteButtonDefaults.buttonColors.
border Optional RemoteDp that will be used to resolve the border for this button in different states.
borderColor Optional RemoteColor that will be used to resolve the border color for this button in different states.
contentPadding The spacing values to apply internally between the container and the content
content Slot for composable body content displayed on the Button

RemoteButton

Android
@Composable
@RemoteComposable
public fun RemoteButton(
    onClick: Action,
    modifier: RemoteModifier = RemoteModifier,
    secondaryLabel: @Composable @RemoteComposable (RemoteRowScope.() -> Unit)? = null,
    icon: (@Composable () -> Unit)? = null,
    enabled: RemoteBoolean = true.rb,
    containerPainter: RemotePainter? = null,
    disabledContainerPainter: RemotePainter? = null,
    colors: RemoteButtonColors =
        RemoteButtonDefaults.buttonWithNullableContainerPainterColors(containerPainter),
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    shape: RemoteShape = RemoteButtonDefaults.shape,
    contentPadding: RemotePaddingValues = RemoteButtonDefaults.ContentPadding,
    label: @Composable @RemoteComposable RemoteRowScope.() -> Unit,
): Unit

Wear Material3 RemoteButton that offers parameters for optional container image backgrounds, with three slots and a specific layout for an icon, label and secondaryLabel. The icon and secondaryLabel are optional. The items are laid out with the icon, if provided, at the start of a row, with a column next containing the two label slots.

An image background is a means to reinforce the meaning of information in a Button. Buttons should have a content color that contrasts with the background image and scrim.

This RemoteButton takes containerPainter for the container image background to be drawn when the button is enabled and disabledContainerPainter for the image background when the button is disabled (the RemoteButtonColors containerColor and disabledContainerColor properties are ignored). It is recommended to use RemoteButtonDefaults.containerPainter to create the painters so that a scrim is drawn on top of the container image, ensuring that any content above the background is legible. If painters are not provided, a tonal color shape would be used as the button background.

The RemoteButton is stadium-shaped by default and its standard height is designed to take 2 lines of text - either a two-line label or both a single line label and a secondary label. With localisation and/or large font sizes, the RemoteButton height adjusts to accommodate the contents. The label and secondary label should be consistently aligned.

RemoteButton can be enabled or disabled. A disabled button will not respond to click events.

Example of a RemoteButton with an image background, an icon and a secondary label:

Parameters

onClick Will be called when the user clicks the button
modifier Modifier to be applied to the button
secondaryLabel A slot for providing the button's secondary label. The contents are expected to be text which is "start" aligned if there is an icon preset and "start" or "center" aligned if not. label and secondaryLabel contents should be consistently aligned.
icon A slot for providing the button's icon. The contents are expected to be a horizontally and vertically aligned icon of size RemoteButtonDefaults.IconSize or RemoteButtonDefaults.LargeIconSize.
enabled Controls the enabled state of the button. When false, this button will not be clickable
containerPainter The RemotePainter to use to draw the container image of the RemoteButton, such as returned by RemoteButtonDefaults.containerPainter.
disabledContainerPainter RemotePainter to use to draw the container of the RemoteButton when not enabled, such as returned by RemoteButtonDefaults.disabledContainerPainter.
shape Defines the button's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material3 Theme
colors RemoteButtonColors that will be used to resolve the background and content color for this button in different states (the containerColor and disabledContainerColor are overridden by containerPainter and disabledContainerPainter respectively). See RemoteButtonDefaults.buttonWithContainerPainterColors.
border Optional RemoteDp that will be used to resolve the border for this button in different states.
borderColor Optional RemoteColor that will be used to resolve the border color for this button in different states.
contentPadding The spacing values to apply internally between the container and the content
label A slot for providing the button's main label. The contents are expected to be text which is "start" aligned if there is an icon preset and "start" or "center" aligned if not.