OudsRadioButton
OUDS Radio button design guidelines
Radio buttons are input controls that allow users to select a single option from a set of mutually exclusive choices.
The standalone radio button variant can be used when the radio selector control is nested within another component and an alternative label is provided.
Parameters
Controls the selected state of the radio button.
Callback invoked on radio button click. If null
, then this radio button will not be interactable, unless something else handles its input events and updates its state.
Modifier applied to the layout of the radio button.
Controls the enabled state of the radio button. When false
, this radio button will not be clickable.
Controls the error state of the radio button.
Optional hoisted MutableInteractionSource for observing and emitting Interactions for this radio button. Note that if null
is provided, interactions will still happen internally.
See also
If you want to use a radio button with an associated label and other optional elements.
Samples
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.orange.ouds.core.component.OudsRadioButton
fun main() {
//sampleStart
val identifiers = listOf(0, 1)
var selectedId by rememberSaveable { mutableIntStateOf(identifiers.first()) }
Column(modifier = Modifier.selectableGroup()) {
identifiers.forEach { id ->
OudsRadioButton(
selected = id == selectedId,
onClick = { selectedId = id }
)
}
}
//sampleEnd
}