![]() |
![]() |
import React, { useState } from 'react-native';
import { Checkbox } from '@pbsc/react-native-ui-components';
const [checked, setChecked] = useState(false);
// ...
const handleCheckboxChange = (value) => {
setChecked(value);
};
// ...
<Checkbox
label="This is Checkbox"
checked={checked}
onChange={handleCheckboxChange}
helperText="This is helper text for checkbox."
hasHelperTextIcon={true}
helperTextCustomIcon={
<Image
source={require('../images/info.png')}
style={{ width: 12, height: 12 }}
/>
}
/>Type: string
The text to use for the label.
Type: Component
Label component to use as label. When defined, it would not use the label prop, and would render the component as a Label instead.
Type: boolean
Default value: false
Whether the Checkbox is checked or not. If true the Checkbox will be turned on
Type: function
Callback that is called when the Checkbox's status changes. (checked -> unchecked or vice versa)
Type: string
Text for additional info.
Type: boolean
Default value: false
If true, user won't be able to interact with the component.
Type: string/number
Default value: '80%'
Set the width of the Checkbox including its label
Type: number
Default value: 32
Set the size of the Checkbox
Type: number
Default value: 2
Set the width of the Checkbox's border
Type: hexColorCode (ex: #ff00ff)
Default value: #7a81ff
Border color of the Checkbox
Type: hexColorCode (ex: #ff00ff)
Default value: #ebebeb
Background color when the Checkbox is unchecked.
Type: hexColorCode (ex: #ff00ff)
Default value: #7a81ff
Background color when the Checkbox is checked.
Type: hexColorCode (ex: #ff00ff)
Default value: #ffffff
Checkmark's color
Type: hexColorCode (ex: #ff00ff)
Default value: #000000
Label's color
Type: object
Set style of checkbox part
Type: object
Set style of label part
Type: object
Set style of helper text part
Type: boolean
Enable custom component (ex: helperTextCustomIcon) to place before helperText
Type: jsx component
A custom component (usually svg component or Image) to place icon before helperText and can be used for errors as well.
Type: function
Callback function invoked when the checkbox label is pressed. If the labelComponent is defined, this would not be invoked. It is called only if the label prop is provided.

