RemoteIconButton

Functions summary

Unit
@Composable
@RemoteComposable
RemoteIconButton(
    onClick: RemoteAction,
    modifier: RemoteModifier,
    enabled: RemoteBoolean,
    shapes: RemoteIconButtonShapes,
    colors: RemoteIconButtonColors,
    border: RemoteBorderStroke?,
    content: @Composable @RemoteComposable () -> Unit
)

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

Functions

@Composable
@RemoteComposable
fun RemoteIconButton(
    onClick: RemoteAction,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    shapes: RemoteIconButtonShapes = RemoteIconButtonDefaults.shapes(),
    colors: RemoteIconButtonColors = RemoteIconButtonDefaults.iconButtonColors(),
    border: RemoteBorderStroke? = null,
    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 a RemoteIconButton:

import androidx.compose.remote.creation.compose.action.hostAction
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
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.RemoteIconButtonDefaults
import androidx.wear.compose.remote.material3.previews.utils.TestImageVectors

RemoteIconButton(
    onClick = hostAction("volume_up".rs),
    modifier = modifier,
    colors = RemoteIconButtonDefaults.filledTonalIconButtonColors(),
) {
    RemoteIcon(
        imageVector = TestImageVectors.VolumeUp,
        contentDescription = null,
        modifier = RemoteModifier.size(RemoteIconButtonDefaults.DefaultIconSize),
    )
}

Example of a RemoteIconButton with corner animation on press:

import androidx.compose.remote.creation.compose.action.hostAction
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
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.RemoteIconButtonDefaults
import androidx.wear.compose.remote.material3.previews.utils.TestImageVectors

RemoteIconButton(
    onClick = hostAction("volume_up".rs),
    modifier = modifier,
    shapes = RemoteIconButtonDefaults.animatedShapes(),
    colors = RemoteIconButtonDefaults.filledIconButtonColors(),
) {
    RemoteIcon(
        imageVector = TestImageVectors.VolumeUp,
        contentDescription = null,
        modifier = RemoteModifier.size(RemoteIconButtonDefaults.DefaultIconSize),
    )
}
Parameters
onClick: RemoteAction

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.

shapes: RemoteIconButtonShapes = RemoteIconButtonDefaults.shapes()

Defines the shape for this icon button, including a pressed shape when animated. Defaults to a static shape based on RemoteIconButtonDefaults.shape, or use RemoteIconButtonDefaults.animatedShapes to animate the corners on press. The press animation is driven by touch events on the player, and is not shown by players that don't dispatch them.

colors: RemoteIconButtonColors = RemoteIconButtonDefaults.iconButtonColors()

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

border: RemoteBorderStroke? = null

Optional RemoteBorderStroke that will be used to resolve the border for this button in different states, or null for no border.

content: @Composable @RemoteComposable () -> Unit

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