Selectable
@Composable
Base selectable component for building single-selection controls (radio buttons, tabs).
Unlike Toggleable, this does not toggle on click - it only selects. The parent is responsible for managing which item is selected (single-selection semantics).
Since
0.6.0
Example - building a RadioButton:
Selectable(
selected = isSelected,
onClick = onSelect,
modifier = Modifier
.size(20.dp)
.semantics { role = Role.RadioButton },
style = myRadioStyle,
) {
// Draw your selection indicator here
}Content copied to clipboard
Parameters
selected
Whether this item is currently selected.
onClick
Callback invoked when the item is clicked.
modifier
Modifier to apply to the selectable.
enabled
Whether the control is enabled.
style
The Style for interaction states.
interactionSource
Optional MutableInteractionSource for observing Interactions.
content
Visual content of the control.