custom

abstract fun custom(selected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier, rippleColor: Color = SparkTheme.colors.outlineHigh, content: @Composable () -> Unit): SegmentedButtonItem(source)

Segment with fully custom content. Use this when no other scope variant fits, for example when segment appearance must vary with the selected value (e.g. a color-coded energy-rating scale).

The content lambda is centred inside the segment's touch target. Enabled state and indicator shape are still controlled by the enclosing SegmentedControl.

To reuse the same animations as built-in segments, call SegmentedControlDefaults.segmentLabelStyle for text color and weight, or SegmentedControlDefaults.segmentIconColor for icon tint.

Accessibility: content must produce at least one composable that contributes text semantics (e.g. com.adevinta.spark.components.text.Text, or a composable with a non-null contentDescription). If the content is purely visual, add a label via modifier = Modifier.semantics { contentDescription = "…" }.

Parameters

selected

Whether this segment is currently selected.

onClick

Called when the user taps this segment.

modifier

Modifier applied to this segment's touch-target box.

rippleColor

Colour of the tap ripple. Defaults to com.adevinta.spark.tokens.SparkColors.outlineHigh; override to match a segment's custom background.

content

Composable content rendered inside the segment.