androidx.wear.compose.remote.material3

Classes

RemoteButtonColors

Represents the container and content colors used in buttons in different states.

RemoteIconButtonColors

Represents the container and content colors used in a text button in different states.

RemoteTextButtonColors

Represents the container and content colors used in a text button in different states.

Objects

RemoteButtonDefaults

Contains the default values used by RemoteButton

RemoteButtonGroupDefaults

Contains the default values used by RemoteButtonGroup

RemoteIconButtonDefaults

Contains the default values used by RemoteIconButton.

RemoteTextButtonDefaults

Contains the default values used by RemoteTextButton.

Top-level functions summary

Unit
@Composable
@RemoteComposable
RemoteButton(
    onClick: Action,
    modifier: RemoteModifier,
    enabled: RemoteBoolean,
    colors: RemoteButtonColors,
    shape: RemoteShape,
    contentPadding: RemotePaddingValues,
    border: RemoteDp?,
    borderColor: RemoteColor?,
    content: @Composable @RemoteComposable RemoteRowScope.() -> Unit
)

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

Unit
@Composable
@RemoteComposable
RemoteButton(
    onClick: Action,
    containerPainter: RemotePainter,
    modifier: RemoteModifier,
    enabled: RemoteBoolean,
    disabledContainerPainter: RemotePainter,
    colors: RemoteButtonColors,
    border: RemoteDp?,
    borderColor: RemoteColor?,
    shape: RemoteShape,
    contentPadding: RemotePaddingValues,
    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.

Unit
@Composable
@RemoteComposable
RemoteButton(
    onClick: Action,
    modifier: RemoteModifier,
    secondaryLabel: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)?,
    icon: (@Composable () -> Unit)?,
    enabled: RemoteBoolean,
    containerPainter: RemotePainter?,
    disabledContainerPainter: RemotePainter?,
    colors: RemoteButtonColors,
    border: RemoteDp?,
    borderColor: RemoteColor?,
    shape: RemoteShape,
    contentPadding: RemotePaddingValues,
    label: @Composable @RemoteComposable RemoteRowScope.() -> 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.

Unit
@Composable
@RemoteComposable
RemoteButtonGroup(
    modifier: RemoteModifier,
    spacing: RemoteDp,
    contentPadding: RemotePaddingValues,
    verticalAlignment: RemoteAlignment.Vertical,
    content: @RemoteComposable @Composable RemoteRowScope.() -> Unit
)

Layout component to implement an expressive group of buttons in a row.

Unit
@Composable
@RemoteComposable
RemoteCompactButton(
    onClick: Action,
    modifier: RemoteModifier,
    icon: (@Composable () -> Unit)?,
    enabled: RemoteBoolean,
    shape: RemoteShape,
    colors: RemoteButtonColors,
    border: RemoteDp?,
    borderColor: RemoteColor?,
    contentPadding: RemotePaddingValues,
    label: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)?
)

A Wear Material3 RemoteCompactButton that offers two slots and a specific layout for an icon and label.

Unit
@RemoteComposable
@Composable
RemoteIcon(
    imageVector: RemoteImageVector,
    contentDescription: RemoteString?,
    modifier: RemoteModifier,
    tint: RemoteColor
)

Composable function that displays an icon using an RemoteImageVector.

Unit
@Composable
@RemoteComposable
RemoteIconButton(
    onClick: Action,
    modifier: RemoteModifier,
    colors: RemoteIconButtonColors,
    enabled: RemoteBoolean,
    border: RemoteDp?,
    borderColor: RemoteColor?,
    shape: RemoteShape,
    content: @Composable @RemoteComposable () -> Unit
)

Wear Material RemoteIconButton is a circular, icon-only button with transparent background and no border.

Unit
@Composable
@RemoteComposable
RemoteText(
    text: RemoteString,
    modifier: RemoteModifier,
    color: RemoteColor?,
    fontSize: RemoteTextUnit?,
    fontStyle: FontStyle?,
    fontWeight: FontWeight?,
    fontFamily: FontFamily?,
    textAlign: TextAlign?,
    overflow: TextOverflow,
    maxLines: Int,
    style: RemoteTextStyle,
    fontVariationSettings: FontVariation.Settings?
)

High level element that displays text and provides semantics / accessibility information.

Unit
@Composable
@RemoteComposable
RemoteTextButton(
    onClick: Action,
    modifier: RemoteModifier,
    colors: RemoteTextButtonColors,
    enabled: RemoteBoolean,
    border: RemoteDp?,
    borderColor: RemoteColor?,
    shape: RemoteShape,
    content: @Composable @RemoteComposable () -> Unit
)

Wear Material RemoteTextButton is a circular, text-only button with transparent background and no border.

Extension functions summary

RemoteModifier

Modifier to be applied to a RemoteButton to ensure that its size meets the recommended minimums.

Top-level functions

@Composable
@RemoteComposable
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
): 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.

import androidx.compose.remote.core.operations.TextFromFloat
import androidx.compose.remote.creation.compose.action.ValueChange
import androidx.compose.remote.creation.compose.state.rememberMutableRemoteInt
import androidx.compose.remote.creation.compose.state.rs
import androidx.wear.compose.remote.material3.RemoteButton
import androidx.wear.compose.remote.material3.RemoteText

val tapCount = rememberMutableRemoteInt(0)
val countSuffix = " (".rs + tapCount.toRemoteString(10, TextFromFloat.PAD_PRE_NONE) + " taps)"

RemoteButton(ValueChange(tapCount, tapCount + 1), modifier = modifier) {
    RemoteText("Tap me!".rs + countSuffix)
}
Parameters
onClick: Action

Will be called when the user clicks the button

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button

enabled: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will not be clickable. It must be a constant value.

colors: RemoteButtonColors = RemoteButtonDefaults.buttonColors()

RemoteButtonColors that will be used to resolve the background and content color for this button in different states. See RemoteButtonDefaults.buttonColors.

shape: RemoteShape = RemoteButtonDefaults.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

contentPadding: RemotePaddingValues = RemoteButtonDefaults.ContentPadding

The spacing values to apply internally between the container and the content

border: RemoteDp? = null

Optional RemoteDp that will be used to resolve the border for this button in different states.

borderColor: RemoteColor? = null

Optional RemoteColor that will be used to resolve the border color for this button in different states.

content: @Composable @RemoteComposable RemoteRowScope.() -> Unit

Slot for composable body content displayed on the Button

@Composable
@RemoteComposable
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
): 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: Action

Will be called when the user clicks the button

containerPainter: RemotePainter

The background image of this RemoteButton when enabled

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button

enabled: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will not be clickable. It must be a constant value.

disabledContainerPainter: RemotePainter = RemoteButtonDefaults.disabledContainerPainter(containerPainter)

The background image of this RemoteButton when disabled

colors: RemoteButtonColors = RemoteButtonDefaults.buttonWithNullableContainerPainterColors(containerPainter)

RemoteButtonColors that will be used to resolve the background and content color for this button in different states. See RemoteButtonDefaults.buttonColors.

border: RemoteDp? = null

Optional RemoteDp that will be used to resolve the border for this button in different states.

borderColor: RemoteColor? = null

Optional RemoteColor that will be used to resolve the border color for this button in different states.

shape: RemoteShape = RemoteButtonDefaults.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

contentPadding: RemotePaddingValues = RemoteButtonDefaults.ContentPadding

The spacing values to apply internally between the container and the content

content: @Composable @RemoteComposable RemoteRowScope.() -> Unit

Slot for composable body content displayed on the Button

@Composable
@RemoteComposable
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: Action

Will be called when the user clicks the button

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button

secondaryLabel: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)? = null

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: (@Composable () -> Unit)? = null

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: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will not be clickable

containerPainter: RemotePainter? = null

The RemotePainter to use to draw the container image of the RemoteButton, such as returned by RemoteButtonDefaults.containerPainter.

disabledContainerPainter: RemotePainter? = null

RemotePainter to use to draw the container of the RemoteButton when not enabled, such as returned by RemoteButtonDefaults.disabledContainerPainter.

colors: RemoteButtonColors = RemoteButtonDefaults.buttonWithNullableContainerPainterColors(containerPainter)

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: RemoteDp? = null

Optional RemoteDp that will be used to resolve the border for this button in different states.

borderColor: RemoteColor? = null

Optional RemoteColor that will be used to resolve the border color for this button in different states.

shape: RemoteShape = RemoteButtonDefaults.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

contentPadding: RemotePaddingValues = RemoteButtonDefaults.ContentPadding

The spacing values to apply internally between the container and the content

label: @Composable @RemoteComposable RemoteRowScope.() -> Unit

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.

@Composable
@RemoteComposable
fun RemoteButtonGroup(
    modifier: RemoteModifier = RemoteModifier,
    spacing: RemoteDp = RemoteButtonGroupDefaults.Spacing,
    contentPadding: RemotePaddingValues = RemoteButtonGroupDefaults.fullWidthPaddings(),
    verticalAlignment: RemoteAlignment.Vertical = RemoteAlignment.CenterVertically,
    content: @RemoteComposable @Composable RemoteRowScope.() -> Unit
): Unit

Layout component to implement an expressive group of buttons in a row.

Example of 3 buttons, the middle one bigger:

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Call
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.MailOutline
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.fillMaxWidth
import androidx.wear.compose.remote.material3.RemoteButtonGroup

RemoteButtonGroup(modifier = modifier.fillMaxWidth()) {
    Button(Icons.Filled.MailOutline, RemoteModifier.weight(1f))
    Button(Icons.Filled.Favorite, RemoteModifier.weight(1f))
    Button(Icons.Filled.Call, RemoteModifier.weight(1f))
}
Parameters
modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button group

spacing: RemoteDp = RemoteButtonGroupDefaults.Spacing

the amount of spacing between buttons

contentPadding: RemotePaddingValues = RemoteButtonGroupDefaults.fullWidthPaddings()

The spacing values to apply internally between the container and the content

verticalAlignment: RemoteAlignment.Vertical = RemoteAlignment.CenterVertically

the vertical alignment of the button group's children.

content: @RemoteComposable @Composable RemoteRowScope.() -> Unit

the content and properties of each button. The Ux guidance is to use no more than 3 buttons within a ButtonGroup.

@Composable
@RemoteComposable
fun RemoteCompactButton(
    onClick: Action,
    modifier: RemoteModifier = RemoteModifier,
    icon: (@Composable () -> Unit)? = null,
    enabled: RemoteBoolean = true.rb,
    shape: RemoteShape = RemoteButtonDefaults.compactButtonShape,
    colors: RemoteButtonColors = RemoteButtonDefaults.buttonColors(),
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    contentPadding: RemotePaddingValues = RemoteButtonDefaults.CompactButtonContentPadding,
    label: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)?
): Unit

A Wear Material3 RemoteCompactButton that offers two slots and a specific layout for an icon and label. Both the icon and label are optional however it is expected that at least one will be provided.

The RemoteCompactButton is Stadium shaped and has a max height designed to take no more than one line of text and/or one icon. The default max height is ButtonDefaults.CompactButtonHeight. This includes a visible button height of 32.dp and 8.dp of padding above and below the button in order to meet accessibility guidelines that request a minimum of 48.dp height and width of tappable area.

If an icon is provided then the labels should be "start" aligned, e.g. left aligned in left-to-right mode so that the text starts next to the icon.

The items are laid out as follows.

  1. If a label is provided then the button will be laid out with the optional icon at the start of a row followed by the label with a default max height of RemoteButtonDefaults.CompactButtonHeight.

  2. If only an icon is provided it will be laid out vertically and horizontally centered with a default height of RemoteButtonDefaults.CompactButtonHeight and the default width of RemoteButtonDefaults.IconOnlyCompactButtonWidth

If neither icon nor label is provided then the button will displayed like an icon only button but with no contents or background color.

RemoteCompactButton 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.

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

import androidx.compose.remote.core.operations.TextFromFloat
import androidx.compose.remote.creation.compose.action.ValueChange
import androidx.compose.remote.creation.compose.state.rememberMutableRemoteInt
import androidx.compose.remote.creation.compose.state.rs
import androidx.wear.compose.remote.material3.RemoteCompactButton
import androidx.wear.compose.remote.material3.RemoteText

val tapCount = rememberMutableRemoteInt(0)
val countSuffix = " (".rs + tapCount.toRemoteString(10, TextFromFloat.PAD_PRE_NONE) + " taps)"

RemoteCompactButton(
    ValueChange(tapCount, tapCount + 1),
    modifier = modifier,
    label = { RemoteText("Tap me!".rs + countSuffix) },
)
Parameters
onClick: Action

Will be called when the user clicks the button

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button

icon: (@Composable () -> Unit)? = null

A slot for providing the button's icon. The contents are expected to be a horizontally and vertically aligned icon of size RemoteButtonDefaults.ExtraSmallIconSize when used with a label or RemoteButtonDefaults.SmallIconSize when used as the only content in the button.

enabled: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will not be clickable. It must be a constant value.

shape: RemoteShape = RemoteButtonDefaults.compactButtonShape

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 = RemoteButtonDefaults.buttonColors()

RemoteButtonColors that will be used to resolve the background and content color for this button in different states. See RemoteButtonDefaults.buttonColors.

border: RemoteDp? = null

Optional RemoteDp that will be used to resolve the border for this button in different states.

borderColor: RemoteColor? = null

Optional RemoteColor that will be used to resolve the border color for this button in different states.

contentPadding: RemotePaddingValues = RemoteButtonDefaults.CompactButtonContentPadding

The spacing values to apply internally between the container and the content

label: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)?

Slot for composable body content displayed on the Button

@RemoteComposable
@Composable
fun RemoteIcon(
    imageVector: RemoteImageVector,
    contentDescription: RemoteString?,
    modifier: RemoteModifier = RemoteModifier,
    tint: RemoteColor = LocalRemoteContentColor.current
): Unit

Composable function that displays an icon using an RemoteImageVector.

This function provides a way to display icons consistently across both local and remote Compose environments.

Parameters
imageVector: RemoteImageVector

The RemoteImageVector representing the icon to display.

contentDescription: RemoteString?

Text used by accessibility services to describe what this icon represents. This should always be provided unless this icon is used for decorative purposes, and does not represent a meaningful action that a user can take. This text should be localized, such as by using androidx.compose.ui.res.stringResource or similar.

modifier: RemoteModifier = RemoteModifier

The RemoteModifier to apply to the icon.

tint: RemoteColor = LocalRemoteContentColor.current

The color to apply to the icon. Defaults to the current content color.

@Composable
@RemoteComposable
fun RemoteIconButton(
    onClick: Action,
    modifier: RemoteModifier = RemoteModifier,
    colors: RemoteIconButtonColors = RemoteIconButtonDefaults.iconButtonColors(),
    enabled: RemoteBoolean = true.rb,
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    shape: RemoteShape = RemoteIconButtonDefaults.shape,
    content: @Composable @RemoteComposable () -> Unit
): Unit

Wear Material RemoteIconButton is a circular, icon-only button with transparent background and no border. It offers a single slot to take icon or image content.

The default RemoteIconButton has no border and a transparent background for low emphasis actions. For actions that require higher emphasis, consider overriding the colors by RemoteIconButtonColors.copy

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

Example of an RemoteIconButton with shape animation of rounded corners on press:

import androidx.compose.remote.creation.compose.state.rs
import androidx.wear.compose.remote.material3.RemoteIcon
import androidx.wear.compose.remote.material3.RemoteIconButton
import androidx.wear.compose.remote.material3.previews.TestImageVectors

RemoteIconButton(testAction, modifier = modifier, colors = tonalColors) {
    RemoteIcon(imageVector = TestImageVectors.VolumeUp, contentDescription = null)
}
Parameters
onClick: Action

Will be called when the user clicks the button.

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button.

colors: RemoteIconButtonColors = RemoteIconButtonDefaults.iconButtonColors()

RemoteIconButtonColors that will be used to resolve the background and content color for this button in different states.

enabled: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will not be clickable. It must be a constant value.

border: RemoteDp? = null

Optional RemoteDp that will be used to resolve the border for this button in different states.

borderColor: RemoteColor? = null

Optional RemoteColor that will be used to resolve the border color for this button in different states.

shape: RemoteShape = RemoteIconButtonDefaults.shape

Defines the shape for this button. Defaults to a static shape based on RemoteIconButtonDefaults.shape

content: @Composable @RemoteComposable () -> Unit

The content displayed on the text button, expected to be text or image.

@Composable
@RemoteComposable
fun RemoteText(
    text: RemoteString,
    modifier: RemoteModifier = RemoteModifier,
    color: RemoteColor? = null,
    fontSize: RemoteTextUnit? = null,
    fontStyle: FontStyle? = null,
    fontWeight: FontWeight? = null,
    fontFamily: FontFamily? = null,
    textAlign: TextAlign? = LocalTextConfiguration.current.textAlign,
    overflow: TextOverflow = LocalTextConfiguration.current.overflow,
    maxLines: Int = LocalTextConfiguration.current.maxLines,
    style: RemoteTextStyle = LocalRemoteTextStyle.current,
    fontVariationSettings: FontVariation.Settings? = null
): Unit

High level element that displays text and provides semantics / accessibility information.

For ease of use, commonly used parameters from androidx.compose.ui.text.TextStyle are also present here. The order of precedence is as follows:

Parameters
text: RemoteString

The text to be displayed.

modifier: RemoteModifier = RemoteModifier

Modifier to apply to this layout node.

color: RemoteColor? = null

Color to apply to the text.

fontSize: RemoteTextUnit? = null

The size of glyphs to use when painting the text. See androidx.compose.ui.text.TextStyle.fontSize.

fontStyle: FontStyle? = null

The typeface variant to use when drawing the letters (e.g., italic). See androidx.compose.ui.text.TextStyle.fontStyle.

fontWeight: FontWeight? = null

The typeface thickness to use when painting the text (e.g., FontWeight.Bold).

fontFamily: FontFamily? = null

The font family to be used when rendering the text. See androidx.compose.ui.text.TextStyle.fontFamily.

textAlign: TextAlign? = LocalTextConfiguration.current.textAlign

The alignment of the text within the lines of the paragraph. See androidx.compose.ui.text.TextStyle.textAlign.

overflow: TextOverflow = LocalTextConfiguration.current.overflow

How visual overflow should be handled.

maxLines: Int = LocalTextConfiguration.current.maxLines

An optional maximum number of lines for the text to span.

style: RemoteTextStyle = LocalRemoteTextStyle.current

Style configuration for the text such as color, font, line height etc.

fontVariationSettings: FontVariation.Settings? = null

The font variation settings to be applied to the text.

@Composable
@RemoteComposable
fun RemoteTextButton(
    onClick: Action,
    modifier: RemoteModifier = RemoteModifier,
    colors: RemoteTextButtonColors = RemoteTextButtonDefaults.textButtonColors(),
    enabled: RemoteBoolean = true.rb,
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    shape: RemoteShape = RemoteTextButtonDefaults.shape,
    content: @Composable @RemoteComposable () -> Unit
): Unit

Wear Material RemoteTextButton is a circular, text-only button with transparent background and no border. It offers a single slot for text.

The default RemoteTextButton has no border and a transparent background for low emphasis actions. For actions that require higher emphasis, consider overriding the colors by RemoteTextButtonColors.copy

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

Example of an RemoteTextButton with shape animation of rounded corners on press:

import androidx.compose.remote.core.operations.TextFromFloat
import androidx.compose.remote.creation.compose.action.ValueChange
import androidx.compose.remote.creation.compose.state.rememberMutableRemoteInt
import androidx.compose.remote.creation.compose.state.rs
import androidx.wear.compose.remote.material3.RemoteText
import androidx.wear.compose.remote.material3.RemoteTextButton

val tapCount = rememberMutableRemoteInt(0)
val text = "+".rs + tapCount.toRemoteString(3, TextFromFloat.PAD_PRE_NONE)

RemoteTextButton(
    ValueChange(tapCount, tapCount + 1),
    modifier = modifier,
    colors = filledTonalColor(),
) {
    RemoteText(text = text)
}
Parameters
onClick: Action

Will be called when the user clicks the button.

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the button.

colors: RemoteTextButtonColors = RemoteTextButtonDefaults.textButtonColors()

RemoteTextButtonColors that will be used to resolve the background and content color for this button in different states.

enabled: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will not be clickable. It must be a constant value.

border: RemoteDp? = null

Optional RemoteDp that will be used to resolve the border for this button in different states.

borderColor: RemoteColor? = null

Optional RemoteColor that will be used to resolve the border color for this button in different states.

shape: RemoteShape = RemoteTextButtonDefaults.shape

Defines the shape for this button. Defaults to a static shape based on RemoteTextButtonDefaults.shape

content: @Composable @RemoteComposable () -> Unit

The content displayed on the text button, expected to be text or image.

Extension functions

fun RemoteModifier.buttonSizeModifier(): RemoteModifier

Modifier to be applied to a RemoteButton to ensure that its size meets the recommended minimums.