Skip to main content

Checkbox

Usage

primary
function CheckboxUsage() {
const [isOn, setIsOn] = useState(false)

return (
<View>
<Checkbox label="primary" value={isOn} onValueChange={setIsOn} />
</View>
)
}

Status

primary
accent
success
info
warning
error
function CheckboxStatuses() {
return (
<View>
<Checkbox
status="primary"
label="primary"
containerStyle={styles.itemContainer}
/>
<Checkbox
status="accent"
label="accent"
containerStyle={styles.itemContainer}
/>
<Checkbox
status="success"
label="success"
containerStyle={styles.itemContainer}
/>
<Checkbox
status="info"
label="info"
containerStyle={styles.itemContainer}
/>
<Checkbox
status="warning"
label="warning"
containerStyle={styles.itemContainer}
/>
<Checkbox
status="error"
label="error"
containerStyle={styles.itemContainer}
/>
</View>
)
}

Size

small
medium
large
function CheckboxSizes() {
return (
<View row style={{justifyContent: 'space-evenly'}}>
<Checkbox label="small" size="small" />
<Checkbox label="medium" size="medium" />
<Checkbox label="large" size="large" />
</View>
)
}

Intermediate

Indeterminate
Indeterminate
function CheckboxIndeterminate() {
const [isOn, setIsOn] = useState(true)
const [indeterminate, setIndeterminate] = useState(true)

return (
<View row style={{justifyContent: 'space-evenly'}}>
<Checkbox
label="Indeterminate"
value={isOn}
onValueChange={(value) => {
setIsOn(value)
setIndeterminate(false)
}}
containerStyle={styles.itemContainer}
indeterminate={indeterminate}
/>
<Checkbox
label="Indeterminate"
value={isOn}
onValueChange={setIsOn}
containerStyle={styles.itemContainer}
indeterminate
disabled
/>
</View>
)
}

Disabled

Disabled
Disabled
Disabled
function CheckboxDisabled() {
return (
<View row style={{justifyContent: 'space-evenly'}}>
<Checkbox label="Disabled" disabled />
<Checkbox label="Disabled" value status="primary" disabled />
<Checkbox label="Disabled" size="large" disabled />
</View>
)
}

Custom

Agree to T&C
Click here to see Privacy Policy

Props

PropData TypeDefault ValueDescription
ExtendsBaseBooleanFieldProps--Inherits properties from BaseBooleanFieldProps
valueboolean--Control the state of the checkbox with value
indeterminateboolean--Set to true for an intermediate state
onValueChange(value: boolean) => void | Promise<void>--Callback for on value change
styleStyleProp<ViewStyle>--Style of the checkbox
position"left" | "right"rightControl the position of the field
adjacentbooleantrueSet it to false to position them apart i.e. space-between
disabledboolean--Set to true for disabled field
colorstring--Set custom color
labelstring--Label text above the input
captionstring--Caption text below the text input
errorstring--Error text in error `status` below caption text
containerStyleStyleProp<ViewStyle>--Container view style
labelStyleStyleProp<TextStyle>--Label text style
captionStyleStyleProp<TextStyle>--Caption text style
errorStyleStyleProp<TextStyle>--Error text style
statusBlossomStatusprimary--
sizeBlossomSizemedium--
childrenReactNode--Children