androidx.compose.material3

SegmentedButtonDefaults

Object

No hand-written docs yet.

object SegmentedButtonDefaults

Properties

baseShape

@Composable val baseShape: CornerBasedShape

The shape of the segmented button container, for correct behavior this should or the desired CornerBasedShape should be used with itemShape and passed to each segmented button.

BorderWidth

val BorderWidth: Dp

Default border width used in segmented button

IconSize

val IconSize: Dp

Icon size to use for icons used in SegmentedButton

ContentPaddingSince 1.9

val ContentPadding: PaddingValues

The default content padding used by Segmented Buttons

Functions

colors

@Composable
fun colors(): SegmentedButtonColors

Creates a SegmentedButtonColors that represents the different colors used in a SegmentedButton in different states.

@Composable
fun colors(
    activeContainerColor: Color = Color.Unspecified,
    activeContentColor: Color = Color.Unspecified,
    activeBorderColor: Color = Color.Unspecified,
    inactiveContainerColor: Color = Color.Unspecified,
    inactiveContentColor: Color = Color.Unspecified,
    inactiveBorderColor: Color = Color.Unspecified,
    disabledActiveContainerColor: Color = Color.Unspecified,
    disabledActiveContentColor: Color = Color.Unspecified,
    disabledActiveBorderColor: Color = Color.Unspecified,
    disabledInactiveContainerColor: Color = Color.Unspecified,
    disabledInactiveContentColor: Color = Color.Unspecified,
    disabledInactiveBorderColor: Color = Color.Unspecified,
): SegmentedButtonColors

Creates a SegmentedButtonColors that represents the different colors used in a SegmentedButton in different states.

itemShape

@Composable
fun itemShape(
    index: Int,
    count: Int,
    baseShape: CornerBasedShape = this.baseShape,
): Shape

A shape constructor that the button in index should have when there are count buttons in the container.

ActiveIcon

@Composable
fun ActiveIcon()

And icon to indicate the segmented button is checked or selected

Icon

@Composable
fun Icon(
    active: Boolean,
    activeContent: @Composable () -> Unit = { ActiveIcon() },
    inactiveContent: (@Composable () -> Unit)? = null,
)

The default implementation of icons for Segmented Buttons.

borderStroke

fun borderStroke(
    color: Color,
    width: Dp = BorderWidth,
): BorderStroke

Default factory for Segmented Button BorderStroke can be customized through width, and color. When using a width different than default make sure to also update MultiChoiceSegmentedButtonRow or SingleChoiceSegmentedButtonRow space param.