Selectable

@Composable
fun Selectable(selected: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, style: Style = SelectableDefaults.style(), interactionSource: MutableInteractionSource? = null, content: @Composable BoxScope.() -> Unit)

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
}

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.