SegmentedButtonDefaults


Summary

Public functions

Unit

And icon to indicate the segmented button is checked or selected

Cmn
Unit
@Composable
Icon(
    active: Boolean,
    activeContent: @Composable () -> Unit,
    inactiveContent: (@Composable () -> Unit)?
)

The default implementation of icons for Segmented Buttons.

Cmn
BorderStroke
borderStroke(color: Color, width: Dp)

Default factory for Segmented Button BorderStroke can be customized through width, and color.

Cmn
SegmentedButtonColors

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

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

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

Cmn
Shape
@Composable
itemShape(index: Int, count: Int, baseShape: CornerBasedShape)

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

Cmn

Public properties

Dp

Default border width used in segmented button

Cmn
PaddingValues

The default content padding used by Segmented Buttons

Cmn
Dp

Icon size to use for icons used in SegmentedButton

Cmn
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.

Cmn

Public functions

ActiveIcon

@Composable
fun ActiveIcon(): Unit

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
): Unit

The default implementation of icons for Segmented Buttons.

Parameters
active: Boolean

whether the button is activated or not.

activeContent: @Composable () -> Unit = { ActiveIcon() }

usually a checkmark icon of IconSize dimensions.

inactiveContent: (@Composable () -> Unit)? = null

typically an icon of IconSize. It shows only when the button is not checked.

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.

colors

@Composable
fun colors(): SegmentedButtonColors

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

colors

@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.

Parameters
activeContainerColor: Color = Color.Unspecified

the color used for the container when enabled and active

activeContentColor: Color = Color.Unspecified

the color used for the content when enabled and active

activeBorderColor: Color = Color.Unspecified

the color used for the border when enabled and active

inactiveContainerColor: Color = Color.Unspecified

the color used for the container when enabled and inactive

inactiveContentColor: Color = Color.Unspecified

the color used for the content when enabled and inactive

inactiveBorderColor: Color = Color.Unspecified

the color used for the border when enabled and active

disabledActiveContainerColor: Color = Color.Unspecified

the color used for the container when disabled and active

disabledActiveContentColor: Color = Color.Unspecified

the color used for the content when disabled and active

disabledActiveBorderColor: Color = Color.Unspecified

the color used for the border when disabled and active

disabledInactiveContainerColor: Color = Color.Unspecified

the color used for the container when disabled and inactive

disabledInactiveContentColor: Color = Color.Unspecified

the color used for the content when disabled and unchecked

disabledInactiveBorderColor: Color = Color.Unspecified

the color used for the border when disabled and inactive

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.

Parameters
index: Int

the index for this button in the row

count: Int

the count of buttons in this row

baseShape: CornerBasedShape = this.baseShape

the CornerBasedShape the base shape that should be used in buttons that are not in the start or the end.

Public properties

BorderWidth

val BorderWidthDp

Default border width used in segmented button

ContentPadding

val ContentPaddingPaddingValues

The default content padding used by Segmented Buttons

IconSize

val IconSizeDp

Icon size to use for icons used in SegmentedButton

baseShape

val baseShapeCornerBasedShape

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.