Radio Button

A radio button permits users to select only one option from a list of two or more.

TypeResource
DesignFigma
MobileMobile Storybook
CodeGitlab

Radio Preview

Usage

To implement Radio, you can use this tag Radio in the Kotlin file.

import id.co.biofarma.binduiandroid.components.radio.RadioButton
    var selectedId by remember { mutableStateOf(if (selected) "option1" else "") }
    Radio(
        id = "option1",
        variant = "primary",
        label = "label",
        size = "sm",
        enabled = "true",
        error = "false",
        selected = selectedId == "option1",
        onChange = {
            selectedId = if (selectedId == "option1") "" else "option1"
        }
    )

Examples

Variant

Set the variant prop to primary or secondary for different color.

Radio Preview

Size

Set the size prop to sm, md, or lg for different size.

Alert Preview

Disabled (optional)

Set the enabled prop to true or false.

Alert Preview

Error (optional)

Set the error prop to true or false

Alert Preview


Props

PropsRequiredDefaultTypedescription
labeltrue-stringThe label text for the radio.
idfalse-stringA unique identifier for the radio.
variantfalseprimaryprimary secondaryThe visual color variant of the radio.
sizefalsemdsm md lgThe size of radio.
enabledfalsefalsetrue falseIf false, radio will be set to disabled state
selectedfalsefalsetrue falseIf true, radio will be set to checked state.
errorfalsefalsetrue falseIf true, radio will be set to error state.
onChangefalse-functionCallback function to run when the radio is clicked.
stylefalse-ModifierTo decorate or add behavior to Compose UI elements.
BIND © Biofarma Innovate Next-level Design .