androidx.compose.material3

SplitButtonDefaultsSince 1.10

Object

No hand-written docs yet.

Contains default values used by SplitButtonLayout and its style variants.

object SplitButtonDefaults

Properties

LeadingIconSize

val LeadingIconSize: Dp

Default icon size for the leading button

TrailingIconSize

val TrailingIconSize: Dp

Default icon size for the trailing button

Spacing

val Spacing: Dp

Default spacing between the leading and trailing button

ExtraSmallInnerCornerSize

val ExtraSmallInnerCornerSize: CornerSize

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

SmallInnerCornerSize

val SmallInnerCornerSize: CornerSize

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

MediumInnerCornerSize

val MediumInnerCornerSize: CornerSize

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

LargeInnerCornerSize

val LargeInnerCornerSize: CornerSize

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

ExtraLargeInnerCornerSize

val ExtraLargeInnerCornerSize: CornerSize

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

ExtraSmallInnerCornerSizePressed

val ExtraSmallInnerCornerSizePressed: CornerSize

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

SmallInnerCornerSizePressed

val SmallInnerCornerSizePressed: CornerSize

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

MediumInnerCornerSizePressed

val MediumInnerCornerSizePressed: CornerSize

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

LargeInnerCornerSizePressed

val LargeInnerCornerSizePressed: CornerSize

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

ExtraLargeInnerCornerSizePressed

val ExtraLargeInnerCornerSizePressed: CornerSize

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

OuterCornerSize

val OuterCornerSize: CornerSize

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

ExtraSmallLeadingButtonContentPadding

val ExtraSmallLeadingButtonContentPadding: PaddingValues

Default content padding of the extra small leading button

SmallLeadingButtonContentPadding

val SmallLeadingButtonContentPadding: PaddingValues

Default content padding of the small leading button

MediumLeadingButtonContentPadding

val MediumLeadingButtonContentPadding: PaddingValues

Default content padding of the medium leading button

LargeLeadingButtonContentPadding

val LargeLeadingButtonContentPadding: PaddingValues

Default content padding of the large leading button

ExtraLargeLeadingButtonContentPadding

val ExtraLargeLeadingButtonContentPadding: PaddingValues

Default content padding of the extra large leading button

ExtraSmallTrailingButtonContentPadding

val ExtraSmallTrailingButtonContentPadding: PaddingValues

Default content padding of the extra small trailing button

SmallTrailingButtonContentPadding

val SmallTrailingButtonContentPadding: PaddingValues

Default content padding of the small trailing button

MediumTrailingButtonContentPadding

val MediumTrailingButtonContentPadding: PaddingValues

Default content padding of the medium trailing button

LargeTrailingButtonContentPadding

val LargeTrailingButtonContentPadding: PaddingValues

Default content padding of the large trailing button

ExtraLargeTrailingButtonContentPadding

val ExtraLargeTrailingButtonContentPadding: PaddingValues

Default content padding of the extra large trailing button

ExtraSmallTrailingButtonIconSize

val ExtraSmallTrailingButtonIconSize: Dp

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

SmallTrailingButtonIconSize

val SmallTrailingButtonIconSize: Dp

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

MediumTrailingButtonIconSize

val MediumTrailingButtonIconSize: Dp

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

LargeTrailingButtonIconSize

val LargeTrailingButtonIconSize: Dp

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

ExtraLargeTrailingButtonIconSize

val ExtraLargeTrailingButtonIconSize: Dp

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

SmallContainerHeight

val SmallContainerHeight: Dp

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

ExtraSmallContainerHeight

val ExtraSmallContainerHeight: Dp

The default height for an extra small button container.

MediumContainerHeight

val MediumContainerHeight: Dp

The default height for a medium button container.

LargeContainerHeight

val LargeContainerHeight: Dp

The default height for a large button container.

ExtraLargeContainerHeight

val ExtraLargeContainerHeight: Dp

The default height for an extra large button container.

Functions

leadingButtonShapesFor

@Composable
fun leadingButtonShapesFor(buttonHeight: Dp): SplitButtonShapes

Recommended leading button SplitButtonShapes for a provided leading button height.

trailingButtonShapesFor

@Composable
fun trailingButtonShapesFor(buttonHeight: Dp): SplitButtonShapes

Recommended trailing button SplitButtonShapes for a provided trailing button height.

leadingButtonContentPaddingFor

fun leadingButtonContentPaddingFor(buttonHeight: Dp): PaddingValues

Recommended PaddingValues for a provided leading button height.

trailingButtonContentPaddingFor

fun trailingButtonContentPaddingFor(buttonHeight: Dp): PaddingValues

Recommended PaddingValues for a provided trailing button height.

leadingButtonIconSizeFor

fun leadingButtonIconSizeFor(buttonHeight: Dp): Dp

Recommended leading button Icon size for a provided button height.

trailingButtonIconSizeFor

fun trailingButtonIconSizeFor(buttonHeight: Dp): Dp

Recommended trailing button Icon size for a provided button height.

LeadingButton

@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,
)

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.

TrailingButton

@Composable
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,
)

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

@Composable
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,
)

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.

TonalLeadingButton

@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,
)

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.

TonalTrailingButton

@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,
)

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.

OutlinedLeadingButton

@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,
)

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

OutlinedTrailingButton

@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,
)

Creates an outlined trailing button that has the same visual as an 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.

ElevatedLeadingButton

@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,
)

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

ElevatedTrailingButton

@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,
)

Creates an elevated trailing button that has the same visual as an 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.

Library docs

Contains default values used by SplitButtonLayout and its style variants.