SplitButtonDefaults


Contains default values used by SplitButtonLayout and its style variants.

Summary

Public functions

Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
ElevatedLeadingButton(
    onClick: () -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Create a elevated leading button that has the same visual as a ElevatedButton.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
ElevatedTrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Creates a elevated trailing button that has the same visual as a ElevatedButton.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
LeadingButton(
    onClick: () -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Create a default leading button that has the same visual as a FilledButton.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
OutlinedLeadingButton(
    onClick: () -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Create a elevated leading button that has the same visual as a ElevatedButton.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
OutlinedTrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Creates a outlined trailing button that has the same visual as a OutlinedButton.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
TonalLeadingButton(
    onClick: () -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Create a tonal leading button that has the same visual as a TonalButton.

Cmn
Unit
@ExperimentalMaterial3ExpressiveApi
@Composable
TonalTrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Creates a tonal trailing button that has the same visual as a FilledTonalButton.

Cmn
Unit
@Composable
@ExperimentalMaterial3ExpressiveApi
TrailingButton(
    onClick: () -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Creates a trailing button that has the same visual as a Button.

Cmn
Unit
@Composable
@ExperimentalMaterial3ExpressiveApi
TrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier,
    enabled: Boolean,
    shapes: SplitButtonShapes,
    colors: ButtonColors,
    elevation: ButtonElevation?,
    border: BorderStroke?,
    contentPadding: PaddingValues,
    interactionSource: MutableInteractionSource?,
    content: @Composable RowScope.() -> Unit
)

Creates a trailing button that has the same visual as a Button.

Cmn
PaddingValues

Recommended PaddingValues for a provided leading button height.

Cmn
Dp

Recommended leading button Icon size for a provided button height.

Cmn
SplitButtonShapes

Recommended leading button SplitButtonShapes for a provided leading button height.

Cmn
PaddingValues

Recommended PaddingValues for a provided trailing button height.

Cmn
Dp

Recommended trailing button Icon size for a provided button height.

Cmn
SplitButtonShapes

Recommended trailing button SplitButtonShapes for a provided trailing button height.

Cmn

Public properties

Dp

The default height for an extra large button container.

Cmn
CornerSize

Default extra large size for the leading button end corners and trailing button start corners

Cmn
CornerSize

Default extra large size for the leading button end corners and trailing button start corners when pressed

Cmn
PaddingValues

Default content padding of the extra large leading button

Cmn
PaddingValues

Default content padding of the extra large trailing button

Cmn
Dp

The default size of the icon used inside of an extra large trailing button of a split button.

Cmn
Dp

The default height for an extra small button container.

Cmn
CornerSize

Default extra small size for the leading button end corners and trailing button start corners

Cmn
CornerSize

Default extra small size for the leading button end corners and trailing button start corners when pressed

Cmn
PaddingValues

Default content padding of the extra small leading button

Cmn
PaddingValues

Default content padding of the extra small trailing button

Cmn
Dp

The default size of the icon used inside of an extra small trailing button of a split button.

Cmn
Dp

The default height for a large button container.

Cmn
CornerSize

Default large size for the leading button end corners and trailing button start corners

Cmn
CornerSize

Default large size for the leading button end corners and trailing button start corners when pressed

Cmn
PaddingValues

Default content padding of the large leading button

Cmn
PaddingValues

Default content padding of the large trailing button

Cmn
Dp

The default size of the icon used inside of an large trailing button of a split button.

Cmn
Dp

Default icon size for the leading button

Cmn
Dp

The default height for a medium button container.

Cmn
CornerSize

Default medium size for the leading button end corners and trailing button start corners

Cmn
CornerSize

Default medium size for the leading button end corners and trailing button start corners when pressed

Cmn
PaddingValues

Default content padding of the medium leading button

Cmn
PaddingValues

Default content padding of the medium trailing button

Cmn
Dp

The default size of the icon used inside of an medium trailing button of a split button.

Cmn
CornerSize

Default percentage size for the leading button start corners and trailing button end corners

Cmn
Dp

Default minimum height of the split button.

Cmn
CornerSize

Default small size for the leading button end corners and trailing button start corners

Cmn
CornerSize

Default small size for the leading button end corners and trailing button start corners when pressed

Cmn
PaddingValues

Default content padding of the small leading button

Cmn
PaddingValues

Default content padding of the small trailing button

Cmn
Dp

The default size of the icon used inside of an small trailing button of a split button.

Cmn
Dp

Default spacing between the leading and trailing button

Cmn
Dp

Default icon size for the trailing button

Cmn

Public functions

ElevatedLeadingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun ElevatedLeadingButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.elevatedButtonColors(),
    elevation: ButtonElevation? = ButtonDefaults.elevatedButtonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Create a elevated leading button that has the same visual as a ElevatedButton. To create a filled, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
onClick: () -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.elevatedButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.elevatedButtonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content for the button.

ElevatedTrailingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun ElevatedTrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.elevatedButtonColors(),
    elevation: ButtonElevation? = ButtonDefaults.elevatedButtonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Creates a elevated trailing button that has the same visual as a ElevatedButton. When checked is updated from false to true, the buttons corners will morph to full by default. Pressed shape and checked shape can be customized via shapes param.

To create a tonal, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
checked: Boolean

indicates whether the button is checked. This will trigger the corner morphing animation to reflect the updated state.

onCheckedChange: (Boolean) -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.elevatedButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.elevatedButtonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content to be placed in the button

LeadingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun LeadingButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Create a default leading button that has the same visual as a FilledButton. To create a tonal, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
onClick: () -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.buttonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.buttonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content for the button.

OutlinedLeadingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun OutlinedLeadingButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.outlinedButtonColors(),
    elevation: ButtonElevation? = null,
    border: BorderStroke? = ButtonDefaults.outlinedButtonBorder(enabled),
    contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Create a elevated leading button that has the same visual as a ElevatedButton. To create a filled, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
onClick: () -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.outlinedButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = null

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = ButtonDefaults.outlinedButtonBorder(enabled)

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content for the button.

OutlinedTrailingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun OutlinedTrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.outlinedButtonColors(),
    elevation: ButtonElevation? = null,
    border: BorderStroke? = ButtonDefaults.outlinedButtonBorder(enabled),
    contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Creates a outlined trailing button that has the same visual as a OutlinedButton. When checked is updated from false to true, the buttons corners will morph to full by default. Pressed shape and checked shape can be customized via shapes param.

To create a tonal, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
checked: Boolean

indicates whether the button is checked. This will trigger the corner morphing animation to reflect the updated state.

onCheckedChange: (Boolean) -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.outlinedButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = null

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = ButtonDefaults.outlinedButtonBorder(enabled)

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content to be placed in the button

TonalLeadingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun TonalLeadingButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.filledTonalButtonColors(),
    elevation: ButtonElevation? = ButtonDefaults.filledTonalButtonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Create a tonal leading button that has the same visual as a TonalButton. To create a filled, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
onClick: () -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = leadingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.filledTonalButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.filledTonalButtonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = leadingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content for the button.

TonalTrailingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun TonalTrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.filledTonalButtonColors(),
    elevation: ButtonElevation? = ButtonDefaults.filledTonalButtonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Creates a tonal trailing button that has the same visual as a FilledTonalButton. When checked is updated from false to true, the buttons corners will morph to full by default. Pressed shape and checked shape can be customized via shapes param.

To create a tonal, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
checked: Boolean

indicates whether the button is checked. This will trigger the corner morphing animation to reflect the updated state.

onCheckedChange: (Boolean) -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.filledTonalButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.filledTonalButtonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content to be placed in the button

TrailingButton

@Composable
@ExperimentalMaterial3ExpressiveApi
fun TrailingButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Creates a trailing button that has the same visual as a Button.

To create a tonal, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
onClick: () -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.buttonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.buttonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content to be placed in the button

TrailingButton

@Composable
@ExperimentalMaterial3ExpressiveApi
fun TrailingButton(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight),
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight),
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit
): Unit

Creates a trailing button that has the same visual as a Button. When checked is updated from false to true, the buttons corners will morph to full by default. Pressed shape and checked shape can be customized via shapes param.

To create a tonal, outlined, or elevated version, the default value of Button params can be passed in. For example, ElevatedButton.

The default text style for internal Text components will be set to Typography.labelLarge.

Parameters
checked: Boolean

indicates whether the button is checked. This will trigger the corner morphing animation to reflect the updated state.

onCheckedChange: (Boolean) -> Unit

called when the button is clicked

modifier: Modifier = Modifier

the Modifier to be applied to this button.

enabled: Boolean = true

controls the enabled state of the split button. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

shapes: SplitButtonShapes = trailingButtonShapesFor(SmallContainerHeight)

the SplitButtonShapes that the trailing button will morph between depending on the user's interaction with the button.

colors: ButtonColors = ButtonDefaults.buttonColors()

ButtonColors that will be used to resolve the colors for this button in different states. See ButtonDefaults.buttonColors.

elevation: ButtonElevation? = ButtonDefaults.buttonElevation()

ButtonElevation used to resolve the elevation for this button in different states. This controls the size of the shadow below the button. See ButtonElevation.shadowElevation.

border: BorderStroke? = null

the border to draw around the container of this button contentPadding the spacing values to apply internally between the container and the content

contentPadding: PaddingValues = trailingButtonContentPaddingFor(SmallContainerHeight)

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

interactionSource: MutableInteractionSource? = null

an optional hoisted MutableInteractionSource for observing and emitting Interactions for this button. You can use this to change the button's appearance or preview the button in different states. Note that if null is provided, interactions will still happen internally.

content: @Composable RowScope.() -> Unit

the content to be placed in the button

leadingButtonContentPaddingFor

fun leadingButtonContentPaddingFor(buttonHeight: Dp): PaddingValues

Recommended PaddingValues for a provided leading button height.

Parameters
buttonHeight: Dp

The height of the button

leadingButtonIconSizeFor

fun leadingButtonIconSizeFor(buttonHeight: Dp): Dp

Recommended leading button Icon size for a provided button height.

Parameters
buttonHeight: Dp

The height of the button

leadingButtonShapesFor

@Composable
@ExperimentalMaterial3ExpressiveApi
fun leadingButtonShapesFor(buttonHeight: Dp): SplitButtonShapes

Recommended leading button SplitButtonShapes for a provided leading button height.

Parameters
buttonHeight: Dp

The height of the button

trailingButtonContentPaddingFor

fun trailingButtonContentPaddingFor(buttonHeight: Dp): PaddingValues

Recommended PaddingValues for a provided trailing button height.

Parameters
buttonHeight: Dp

The height of the button

trailingButtonIconSizeFor

fun trailingButtonIconSizeFor(buttonHeight: Dp): Dp

Recommended trailing button Icon size for a provided button height.

Parameters
buttonHeight: Dp

The height of the button

trailingButtonShapesFor

@Composable
@ExperimentalMaterial3ExpressiveApi
fun trailingButtonShapesFor(buttonHeight: Dp): SplitButtonShapes

Recommended trailing button SplitButtonShapes for a provided trailing button height.

Parameters
buttonHeight: Dp

The height of the button

Public properties

ExtraLargeContainerHeight

@ExperimentalMaterial3ExpressiveApi
val ExtraLargeContainerHeightDp

The default height for an extra large button container.

ExtraLargeInnerCornerSize

val ExtraLargeInnerCornerSizeCornerSize

Default extra large size for the leading button end corners and trailing button start corners

ExtraLargeInnerCornerSizePressed

val ExtraLargeInnerCornerSizePressedCornerSize

Default extra large size for the leading button end corners and trailing button start corners when pressed

ExtraLargeLeadingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val ExtraLargeLeadingButtonContentPaddingPaddingValues

Default content padding of the extra large leading button

ExtraLargeTrailingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val ExtraLargeTrailingButtonContentPaddingPaddingValues

Default content padding of the extra large trailing button

ExtraLargeTrailingButtonIconSize

val ExtraLargeTrailingButtonIconSizeDp

The default size of the icon used inside of an extra large trailing button of a split button.

ExtraSmallContainerHeight

@ExperimentalMaterial3ExpressiveApi
val ExtraSmallContainerHeightDp

The default height for an extra small button container.

ExtraSmallInnerCornerSize

val ExtraSmallInnerCornerSizeCornerSize

Default extra small size for the leading button end corners and trailing button start corners

ExtraSmallInnerCornerSizePressed

val ExtraSmallInnerCornerSizePressedCornerSize

Default extra small size for the leading button end corners and trailing button start corners when pressed

ExtraSmallLeadingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val ExtraSmallLeadingButtonContentPaddingPaddingValues

Default content padding of the extra small leading button

ExtraSmallTrailingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val ExtraSmallTrailingButtonContentPaddingPaddingValues

Default content padding of the extra small trailing button

ExtraSmallTrailingButtonIconSize

val ExtraSmallTrailingButtonIconSizeDp

The default size of the icon used inside of an extra small trailing button of a split button.

LargeContainerHeight

@ExperimentalMaterial3ExpressiveApi
val LargeContainerHeightDp

The default height for a large button container.

LargeInnerCornerSize

val LargeInnerCornerSizeCornerSize

Default large size for the leading button end corners and trailing button start corners

LargeInnerCornerSizePressed

val LargeInnerCornerSizePressedCornerSize

Default large size for the leading button end corners and trailing button start corners when pressed

LargeLeadingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val LargeLeadingButtonContentPaddingPaddingValues

Default content padding of the large leading button

LargeTrailingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val LargeTrailingButtonContentPaddingPaddingValues

Default content padding of the large trailing button

LargeTrailingButtonIconSize

val LargeTrailingButtonIconSizeDp

The default size of the icon used inside of an large trailing button of a split button.

LeadingIconSize

val LeadingIconSizeDp

Default icon size for the leading button

MediumContainerHeight

@ExperimentalMaterial3ExpressiveApi
val MediumContainerHeightDp

The default height for a medium button container.

MediumInnerCornerSize

val MediumInnerCornerSizeCornerSize

Default medium size for the leading button end corners and trailing button start corners

MediumInnerCornerSizePressed

val MediumInnerCornerSizePressedCornerSize

Default medium size for the leading button end corners and trailing button start corners when pressed

MediumLeadingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val MediumLeadingButtonContentPaddingPaddingValues

Default content padding of the medium leading button

MediumTrailingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val MediumTrailingButtonContentPaddingPaddingValues

Default content padding of the medium trailing button

MediumTrailingButtonIconSize

val MediumTrailingButtonIconSizeDp

The default size of the icon used inside of an medium trailing button of a split button.

OuterCornerSize

val OuterCornerSizeCornerSize

Default percentage size for the leading button start corners and trailing button end corners

SmallContainerHeight

val SmallContainerHeightDp

Default minimum height of the split button. This applies to both LeadingButton and TrailingButton. Applies to all 4 variants of the split button

SmallInnerCornerSize

val SmallInnerCornerSizeCornerSize

Default small size for the leading button end corners and trailing button start corners

SmallInnerCornerSizePressed

val SmallInnerCornerSizePressedCornerSize

Default small size for the leading button end corners and trailing button start corners when pressed

SmallLeadingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val SmallLeadingButtonContentPaddingPaddingValues

Default content padding of the small leading button

SmallTrailingButtonContentPadding

@ExperimentalMaterial3ExpressiveApi
val SmallTrailingButtonContentPaddingPaddingValues

Default content padding of the small trailing button

SmallTrailingButtonIconSize

val SmallTrailingButtonIconSizeDp

The default size of the icon used inside of an small trailing button of a split button.

Spacing

val SpacingDp

Default spacing between the leading and trailing button

TrailingIconSize

val TrailingIconSizeDp

Default icon size for the trailing button