Switch

A switch control contains a knob that slides along a track. All parts are required to make a switch.

TypeResource
DesignFigma
WebWeb Storybook
CodeGitlab

Switch preview

Usage

import id.co.biofarma.binduiandroid.components.switch.Switch
Switch(
    id = "switch",
    variant = "primary",
    size = "sm",
    radius = radius,
    mode = mode,
    checked = true,
    disabled = false,
    onChange = {value ->
        println("Switch is now: $value")
    },
    label = "switch",
    labelPosition = "right",
)

Examples

Label Position

Use label position for change label position: left or right

Switch preview 2


Variant (Optional)

Use variant for change variant of switch component: primary, secondary or tertiary

Switch preview 3


Size (Optional)

Use size for change size of switch component: sm, md or lg

Switch preview 4

Props

PropsRequiredDefaultTypedescription
idtrueswitchstringFor set the id of switch component.
labeltrueswitchstringFor set the label of switch component.
labelPositionfalseleftleft rightFor change the label position left or right.
variantfalseprimaryprimary secondary tertiaryFor change the variant of switch component.
sizefalsesmsm md lgFor change the size of switch component.
checkedtruefalsebooleanFor toggle check or not-checked on switch component.
disabledfalsefalsebooleanFor toggle disable or not-disabled on switch component.
modefalselightlight darkFor change color mode light or dark.
BIND © Biofarma Innovate Next-level Design .