TextButtonDefaults

object TextButtonDefaults


Contains the default values used by TextButton.

Summary

Public functions

TextButtonShapes

Returns the default TextButtonShapes for a TextButton with an animation between two CornerBasedShapes when pressed.

TextButtonShapes

Returns a TextButtonShapes with an animation between two CornerBasedShapes when pressed.

TextButtonColors

Returns a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color.

TextButtonColors
@Composable
filledTextButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Returns a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color.

TextButtonColors

Returns a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color.

TextButtonColors
@Composable
filledTonalTextButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Returns a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color.

TextButtonColors

Returns a TextButtonColors as an alternative to the filledTonal TextButtonColors, giving a surface with more chroma to indicate selected or highlighted states that are not primary calls-to-action.

TextButtonColors
@Composable
filledVariantTextButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Returns a TextButtonColors as an alternative to the filledTonal TextButtonColors, giving a surface with more chroma to indicate selected or highlighted states that are not primary calls-to-action.

TextButtonColors

Returns a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color.

TextButtonColors
@Composable
outlinedTextButtonColors(
    contentColor: Color,
    disabledContentColor: Color
)

Returns a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color.

TextButtonShapes

Returns the default TextButtonShapes for a static TextButton.

TextButtonShapes

Returns a TextButtonShapes for a static TextButton.

TextButtonColors

Returns a TextButtonColors for a text button - by default, a transparent background with contrasting content color.

TextButtonColors
@Composable
textButtonColors(
    containerColor: Color,
    contentColor: Color,
    disabledContainerColor: Color,
    disabledContentColor: Color
)

Returns a TextButtonColors for a text button - by default, a transparent background with contrasting content color.

Public properties

Dp

The default size applied for buttons.

Dp

The recommended size for a large button.

Dp

The recommended size for a small button.

TextStyle

The default text style applied for buttons.

TextStyle

The recommended text style for a large button.

Dp

The minimum vertical content padding for the list when a TextButton is placed at the top or bottom edge.

CornerBasedShape

Recommended pressed Shape for TextButton.

RoundedCornerShape

Recommended Shape for TextButton.

TextStyle

The recommended text style for a small button.

Public functions

animatedShapes

Added in 1.5.0
@Composable
fun animatedShapes(): TextButtonShapes

Returns the default TextButtonShapes for a TextButton with an animation between two CornerBasedShapes when pressed.

Example of a simple text button using the default colors, animated when pressed:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledTextButtonColors(),
    shapes = TextButtonDefaults.animatedShapes(),
) {
    Text(text = "ABC")
}

animatedShapes

Added in 1.5.0
@Composable
fun animatedShapes(
    shape: CornerBasedShape? = null,
    pressedShape: CornerBasedShape? = null
): TextButtonShapes

Returns a TextButtonShapes with an animation between two CornerBasedShapes when pressed.

Example of a simple text button using the default colors, animated when pressed:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledTextButtonColors(),
    shapes = TextButtonDefaults.animatedShapes(),
) {
    Text(text = "ABC")
}

Parameters
shape: CornerBasedShape? = null

The normal shape of the TextButton - if null, the default TextButtonDefaults.shape is used.

pressedShape: CornerBasedShape? = null

The pressed shape of the TextButton - if null, the default TextButtonDefaults.pressedShape is used.

filledTextButtonColors

Added in 1.5.0
@Composable
fun filledTextButtonColors(): TextButtonColors

Returns a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

filledTextButtonColors

Added in 1.6.0
@Composable
fun filledTextButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Returns a TextButtonColors with the colors for a filled TextButton- by default, a colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

Example of TextButton with filledTextButtonColors:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledTextButtonColors(),
) {
    Text(text = "ABC")
}

FilledTextButtonSample Composite
Image

Parameters
containerColor: Color = Color.Unspecified

The background color of this text button when enabled

contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContainerColor: Color = Color.Unspecified

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

filledTonalTextButtonColors

Added in 1.5.0
@Composable
fun filledTonalTextButtonColors(): TextButtonColors

Returns a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

filledTonalTextButtonColors

Added in 1.6.0
@Composable
fun filledTonalTextButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Returns a TextButtonColors with the colors for a filled, tonal TextButton- by default, a muted colored background with a contrasting content color. If the text button is disabled then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

Example of TextButton with filledTonalTextButtonColors:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledTonalTextButtonColors(),
) {
    Text(text = "ABC")
}

FilledTonalTextButtonSample Composite
Image

Parameters
containerColor: Color = Color.Unspecified

The background color of this text button when enabled

contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContainerColor: Color = Color.Unspecified

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

filledVariantTextButtonColors

Added in 1.5.0
@Composable
fun filledVariantTextButtonColors(): TextButtonColors

Returns a TextButtonColors as an alternative to the filledTonal TextButtonColors, giving a surface with more chroma to indicate selected or highlighted states that are not primary calls-to-action. If the text button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.

Example of creating a TextButton with filledVariantTextButtonColors:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledVariantTextButtonColors(),
) {
    Text(text = "ABC")
}

FilledVariantTextButtonSample Composite
Image

filledVariantTextButtonColors

Added in 1.6.0
@Composable
fun filledVariantTextButtonColors(
    containerColor: Color = Color.Unspecified,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Returns a TextButtonColors as an alternative to the filledTonal TextButtonColors, giving a surface with more chroma to indicate selected or highlighted states that are not primary calls-to-action. If the text button is disabled then the colors will default to the MaterialTheme onSurface color with suitable alpha values applied.

Example of creating a TextButton with filledVariantTextButtonColors:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.filledVariantTextButtonColors(),
) {
    Text(text = "ABC")
}

FilledVariantTextButtonSample Composite
Image

Parameters
containerColor: Color = Color.Unspecified

The background color of this text button when enabled

contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContainerColor: Color = Color.Unspecified

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

outlinedTextButtonColors

Added in 1.5.0
@Composable
fun outlinedTextButtonColors(): TextButtonColors

Returns a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color. If the button is disabled, then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

outlinedTextButtonColors

Added in 1.6.0
@Composable
fun outlinedTextButtonColors(
    contentColor: Color = Color.Unspecified,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Returns a TextButtonColors with the colors for an outlined TextButton- by default, a transparent background with contrasting content color. If the button is disabled, then the colors will default to ColorScheme.onSurface with suitable alpha values applied.

Example of TextButton with outlinedTextButtonColors and ButtonDefaults.outlinedButtonBorder:

import androidx.wear.compose.material3.ButtonDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults

TextButton(
    onClick = { /* Do something */ },
    colors = TextButtonDefaults.outlinedTextButtonColors(),
    border = ButtonDefaults.outlinedButtonBorder(enabled = true),
) {
    Text(text = "ABC")
}

OutlinedTextButtonSample Composite
Image

Parameters
contentColor: Color = Color.Unspecified

The content color of this text button when enabled

disabledContentColor: Color = Color.Unspecified

The content color of this text button when not enabled

shapes

Added in 1.5.0
@Composable
fun shapes(): TextButtonShapes

Returns the default TextButtonShapes for a static TextButton.

shapes

Added in 1.5.0
@Composable
fun shapes(shape: Shape): TextButtonShapes

Returns a TextButtonShapes for a static TextButton.

Parameters
shape: Shape

The normal shape of the TextButton.

textButtonColors

Added in 1.5.0
@Composable
fun textButtonColors(): TextButtonColors

Returns a TextButtonColors for a text button - by default, a transparent background with contrasting content color. If the button is disabled then the colors default to ColorScheme.onSurface with suitable alpha values applied.

textButtonColors

Added in 1.6.0
@Composable
fun textButtonColors(
    containerColor: Color = Color.Transparent,
    contentColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Transparent,
    disabledContentColor: Color = Color.Unspecified
): TextButtonColors

Returns a TextButtonColors for a text button - by default, a transparent background with contrasting content color. If the button is disabled then the colors default to ColorScheme.onSurface with suitable alpha values applied.

Parameters
containerColor: Color = Color.Transparent

the background color of this text button when enabled

contentColor: Color = Color.Unspecified

the content color of this text button when enabled

disabledContainerColor: Color = Color.Transparent

the background color of this text button when not enabled

disabledContentColor: Color = Color.Unspecified

the content color of this text button when not enabled

Public properties

DefaultButtonSize

val DefaultButtonSize: Dp

The default size applied for buttons. It is recommended to apply this size using Modifier.touchTargetAwareSize.

LargeButtonSize

val LargeButtonSize: Dp

The recommended size for a large button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

SmallButtonSize

val SmallButtonSize: Dp

The recommended size for a small button. It is recommended to apply this size using Modifier.touchTargetAwareSize.

defaultButtonTextStyle

Added in 1.5.0
val defaultButtonTextStyle: TextStyle

The default text style applied for buttons.

largeButtonTextStyle

Added in 1.5.0
val largeButtonTextStyle: TextStyle

The recommended text style for a large button.

minimumVerticalListContentPadding

val minimumVerticalListContentPadding: Dp

The minimum vertical content padding for the list when a TextButton is placed at the top or bottom edge. Recommended for use with androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope's androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope.minimumVerticalContentPadding, which allows items to choose a preferred content padding for the list. TransformingLazyColumn takes its contentPadding as the maximum of the preferred content padding values and its own contentPadding parameter.

pressedShape

Added in 1.5.0
val pressedShape: CornerBasedShape

Recommended pressed Shape for TextButton.

shape

Added in 1.5.0
val shape: RoundedCornerShape

Recommended Shape for TextButton.

smallButtonTextStyle

Added in 1.5.0
val smallButtonTextStyle: TextStyle

The recommended text style for a small button.