Skip to main content
Version: 1.0.0

Check Box

Check Box component render a pre-styled checkbox that can easily be re-style by using props.

Example banner

Implementation code

  • Internally controlled checkbox
import { CheckBox } from 'rn-nativeflow';

const Component = () => {
return (
<CheckBox
text='CheckBox'
defaultValue={true}
onPress={(e)=>console.log(e)}
/>
);
}
export default Component;
  • Externally controlled checkbox
import {useState} from 'react';
import { CheckBox } from 'rn-nativeflow';

const Component = () => {

const [value, setValue] = useState(false);

return (
<CheckBox
text='CheckBox'
disableBuiltInState
isChecked={value}
onPress={(e)=>setValue(e)}
/>
);
}
export default Component;
PropTypeDefaultDescription
variantsquare, roundsquare
isCheckedbooleanfalseIt check the checkbox when isChecked=true and uncheck it when isChecked=false, It works when disableBuiltInState=true
defaultValuebooleanfalseIt sets the default value of checkbox when disableBuiltInState=false
activeBgColorstringIt sets the background color of checkbox when checkbox is checked
inActiveBgColorstringIt sets the background color of checkbox when checkbox is unchecked
iconColorstringIt sets the color of check icon.
disableBuiltInStatebooleanfalseCheckbox control the state internally when disableBuiltInState=false
disabledbooleanfalseIt disable the checkbox and prevent user clicks
textstringIt sets the text on the right side of the checkbox
sizenumber18It sets the size of the checkbox
iconSizenumberwhen iconSize is not provided to the component then It change the icon size according to the size prop otherwise it will apply iconSize to the icon
containerStyleobjectHelps to change the styles of the checkbox main container
textStyleobjectHelps to change the text styles of the right text of checkbox
checkBoxStyleobjectHelps to change the text styles of the checkbox