Checkbox

Checkboxes are used in forms when users need to select multiple options from a list.

TypeResource
DesignFigma
MobileMobile Storybook
CodeGitlab
Checkbox Preview

Usage

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

  import id.co.biofarma.binduiandroid.components.checkbox.Checkbox
    var checkboxState by remember { mutableStateOf(ToggleableState.Off) }
     Checkbox(
        variant = "primary",
        size = "sm",
        label = "Checkbox",
        checked = checkboxState,
        enabled = true,
        indeterminate = true,
        onChange = { checkboxState = it }
    )

Examples

Variant

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

Checkbox Variant

Size

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

Checkbox Preview

Disabled

Set the enabled prop to true or false.

Checkbox Disabled

Indeterminate (optional)

A checkbox input in a form can only have two states: checked or unchecked. It either submits its value or does not. Visually, a checkbox can appear in three states: checked, unchecked, or indeterminate.

Checkbox Preview


Props

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