SplitButtonDefaults


Contains default values used by SplitButton and its style variants.

Summary

Public functions

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
@Composable
@ExperimentalMaterial3ExpressiveApi
TrailingButton(
    onClick: () -> Unit,
    checked: Boolean,
    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 FilledButton.

Cmn
SplitButtonShapes

Default shapes for the leading button.

Cmn
SplitButtonShapes
trailingButtonShapes(startCornerSize: CornerSize)

Default shapes for the trailing button

Cmn

Public properties

CornerSize

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

Cmn
PaddingValues

Default content padding of the leading button

Cmn
Dp

Default icon size for the leading button

Cmn
CornerSize

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

Cmn
Dp

Default spacing between the leading and trailing button

Cmn
PaddingValues

Default content padding of the trailing button

Cmn
Dp

Default icon size for the trailing button

Cmn

Public functions

LeadingButton

@ExperimentalMaterial3ExpressiveApi
@Composable
fun LeadingButton(
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shapes: SplitButtonShapes = leadingButtonShapes(),
    colors: ButtonColors = ButtonDefaults.buttonColors(),
    elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
    border: BorderStroke? = null,
    contentPadding: PaddingValues = LeadingButtonContentPadding,
    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 = leadingButtonShapes()

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 = LeadingButtonContentPadding

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.

TrailingButton

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

Creates a trailing button that has the same visual as a FilledButton. 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
onClick: () -> Unit

called when the button is clicked

checked: Boolean

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

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 = trailingButtonShapes()

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 = TrailingButtonContentPadding

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

leadingButtonShapes

fun leadingButtonShapes(endCornerSize: CornerSize = InnerCornerSize): SplitButtonShapes

Default shapes for the leading button. This defines the shapes the leading button should morph to when enabled, pressed etc.

Parameters
endCornerSize: CornerSize = InnerCornerSize

the size for top end corner and bottom end corner

trailingButtonShapes

fun trailingButtonShapes(startCornerSize: CornerSize = InnerCornerSize): SplitButtonShapes

Default shapes for the trailing button

Parameters
startCornerSize: CornerSize = InnerCornerSize

the size for top start corner and bottom start corner

Public properties

InnerCornerSize

val InnerCornerSizeCornerSize

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

LeadingButtonContentPadding

val LeadingButtonContentPaddingPaddingValues

Default content padding of the leading button

LeadingIconSize

val LeadingIconSizeDp

Default icon size for the leading button

OuterCornerSize

val OuterCornerSizeCornerSize

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

Spacing

val SpacingDp

Default spacing between the leading and trailing button

TrailingButtonContentPadding

val TrailingButtonContentPaddingPaddingValues

Default content padding of the trailing button

TrailingIconSize

val TrailingIconSizeDp

Default icon size for the trailing button