androidx.compose.material3

TextButton

Composable function

One of the button types. It works like Button. Only the parameters that differ are described here.

A button with only text. Use it for the least important actions, and in dialogs and cards.

A text button
A text button
TextButton(onClick = {}) { Text("Learn more") }

Basic

Takes one shape.

@Composable
fun TextButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shape: Shape = ButtonDefaults.textShape,
    colors: ButtonColors = ButtonDefaults.textButtonColors(),
    elevation: ButtonElevation? = null,
    border: BorderStroke? = null,
    contentPadding: PaddingValues = ButtonDefaults.TextButtonContentPadding,
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit,
)

Defaults that differ from Button:

Same as in Button: onClick, modifier, enabled, shape, colors, elevation, border, contentPadding, interactionSource, content.

ExpressiveSince 1.10

Takes shapes: one shape at rest and one while pressed. The button morphs between them.

@Composable
fun TextButton(
    onClick: () -> Unit,
    shapes: ButtonShapes,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    colors: ButtonColors = ButtonDefaults.textButtonColors(),
    elevation: ButtonElevation? = null,
    border: BorderStroke? = null,
    contentPadding: PaddingValues = ButtonDefaults.contentPaddingFor(ButtonDefaults.MinHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit,
)

Defaults that differ from Button:

Same as in Button: onClick, shapes, modifier, enabled, colors, elevation, border, contentPadding, interactionSource, content.

Button types

See also