icon

abstract fun icon(icon: SparkIcon, contentDescription: String, selected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier): SegmentedButtonItem(source)

Segment showing a single medium-sized SparkIcon.

Icon segment

The icon colour animates between com.adevinta.spark.tokens.SparkColors.support when unselected and com.adevinta.spark.tokens.SparkColors.supportVariant when selected.

Because the icon carries no visible text, contentDescription is required so that screen readers can identify the segment. It is also shown as a plain tooltip on long-press.

Parameters

icon

Icon to render.

contentDescription

Accessible label for the segment, announced by TalkBack and shown as a tooltip. Must describe the action or selection represented by the icon (e.g. "List view", "Map view").

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.