StylishSegmentedButton

fun SingleChoiceSegmentedButtonRowScope.StylishSegmentedButton(selected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, shape: Shape = SegmentedButtonDefaults.baseShape, colors: SegmentedButtonColors = SegmentedButtonDefaults.colors(), border: BorderStroke = BorderStroke( width = SegmentedButtonDefaults.BorderWidth, color = when { enabled && selected -> colors.activeBorderColor enabled -> colors.inactiveBorderColor selected -> colors.disabledActiveBorderColor else -> colors.disabledInactiveBorderColor }, ), contentPadding: PaddingValues = SegmentedButtonDefaults.ContentPadding, interactionSource: MutableInteractionSource? = null, icon: @Composable () -> Unit = { SegmentedButtonDefaults.Icon(selected) }, label: @Composable () -> Unit)

A single mutually exclusive option inside StylishSingleChoiceSegmentedButtonRow, wrapping the Material 3 single-choice androidx.compose.material3.SegmentedButton.

The default shape renders the segment as a plain rectangle; for joined rows pass SegmentedButtonDefaults.itemShape(index = i, count = n) so the outer corners round and the inner corners notch.

Parameters

selected

Whether this button is selected.

onClick

Called when the button is tapped.

modifier

Modifier applied to the button root.

enabled

When false, the button ignores pointer input and renders in its disabled colors. Defaults to true.

shape

The shape of this button. Defaults to SegmentedButtonDefaults.baseShape; use SegmentedButtonDefaults.itemShape for multi-segment rows.

colors

SegmentedButtonColors resolving the button colors per state. Defaults to SegmentedButtonDefaults.colors.

border

The BorderStroke around the button. Defaults to the M3 outline style: a SegmentedButtonDefaults.BorderWidth stroke colored by the active/inactive border color for the current selected and enabled state.

contentPadding

Internal spacing between the container and the content. Defaults to SegmentedButtonDefaults.ContentPadding.

interactionSource

Optional hoisted MutableInteractionSource for observing interactions. When null, one is remembered internally.

icon

The icon slot, shown before the label. Defaults to the M3 check/blank icon for the selected state.

label

The button content, typically a Text.

See also


fun MultiChoiceSegmentedButtonRowScope.StylishSegmentedButton(checked: Boolean, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, shape: Shape = SegmentedButtonDefaults.baseShape, colors: SegmentedButtonColors = SegmentedButtonDefaults.colors(), border: BorderStroke = BorderStroke( width = SegmentedButtonDefaults.BorderWidth, color = when { enabled && checked -> colors.activeBorderColor enabled -> colors.inactiveBorderColor checked -> colors.disabledActiveBorderColor else -> colors.disabledInactiveBorderColor }, ), contentPadding: PaddingValues = SegmentedButtonDefaults.ContentPadding, interactionSource: MutableInteractionSource? = null, icon: @Composable () -> Unit = { SegmentedButtonDefaults.Icon(checked) }, label: @Composable () -> Unit)

A single multi-select option inside StylishMultiChoiceSegmentedButtonRow, wrapping the Material 3 multi-choice androidx.compose.material3.SegmentedButton.

The default shape renders the segment as a plain rectangle; for joined rows pass SegmentedButtonDefaults.itemShape(index = i, count = n) so the outer corners round and the inner corners notch.

Parameters

checked

Whether this button is currently checked.

onCheckedChange

Called with the new checked state when the button is tapped.

modifier

Modifier applied to the button root.

enabled

When false, the button ignores pointer input and renders in its disabled colors. Defaults to true.

shape

The shape of this button. Defaults to SegmentedButtonDefaults.baseShape; use SegmentedButtonDefaults.itemShape for multi-segment rows.

colors

SegmentedButtonColors resolving the button colors per state. Defaults to SegmentedButtonDefaults.colors.

border

The BorderStroke around the button. Defaults to the M3 outline style: a SegmentedButtonDefaults.BorderWidth stroke colored by the active/inactive border color for the current checked and enabled state.

contentPadding

Internal spacing between the container and the content. Defaults to SegmentedButtonDefaults.ContentPadding.

interactionSource

Optional hoisted MutableInteractionSource for observing interactions. When null, one is remembered internally.

icon

The icon slot, shown before the label. Defaults to the M3 check/blank icon for the checked state.

label

The button content, typically a Text.

See also