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.

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-beta06
@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 */ }, shapes = TextButtonDefaults.animatedShapes()) {
    Text(text = "ABC")
}

animatedShapes

Added in 1.5.0-beta06
@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 */ }, 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-beta06
@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

@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")
}
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-beta06
@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

@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")
}
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-beta06
@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")
}

filledVariantTextButtonColors

@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")
}
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-beta06
@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

@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")
}
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-beta06
@Composable
fun shapes(): TextButtonShapes

Returns the default TextButtonShapes for a static TextButton.

shapes

Added in 1.5.0-beta06
@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-beta06
@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

@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 DefaultButtonSizeDp

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

LargeButtonSize

val LargeButtonSizeDp

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

SmallButtonSize

val SmallButtonSizeDp

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

defaultButtonTextStyle

Added in 1.5.0-beta06
val defaultButtonTextStyleTextStyle

The default text style applied for buttons.

largeButtonTextStyle

Added in 1.5.0-beta06
val largeButtonTextStyleTextStyle

The recommended text style for a large button.

pressedShape

Added in 1.5.0-beta06
val pressedShapeCornerBasedShape

Recommended pressed Shape for TextButton.

shape

Added in 1.5.0-beta06
val shapeRoundedCornerShape

Recommended Shape for TextButton.

smallButtonTextStyle

Added in 1.5.0-beta06
val smallButtonTextStyleTextStyle

The recommended text style for a small button.