Skip to main content

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 '@nexara/nativeflow';

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

const Component = () => {

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

return (
<CheckBox
label='CheckBox'
disableBuiltInState
isChecked={value}
onPress={(e)=>setValue(e)}
/>
);
}
export default Component;

Props

PropTypeDefaultDescription
variantsquare | roundsquareShape of the checkbox.
isCheckedbooleanfalseControls the checked state when disableBuiltInState=true.
defaultValuebooleanfalseSets the initial checked state when disableBuiltInState=false.
activeBgColorstringBackground color of the checkbox when checked.
inActiveBgColorstring'transparent'Background color of the checkbox when unchecked.
iconColorstringColor of the checkmark icon.
disableBuiltInStatebooleanfalseDisables internal state handling. Use isChecked to control state.
disabledbooleanfalseDisables the checkbox and prevents user interaction.
labelstring'Checkbox'Text displayed to the right of the checkbox.
sizenumber22Width and height of the checkbox.
iconSizenumbersize / 1.5Size of the checkmark icon. Defaults relative to size if not provided.
containerStyleViewStyleCustom styles for the outer container (checkbox + label).
checkBoxStyleViewStyleCustom styles for the checkbox itself.
labelStyleTextStyleCustom styles for the label text.
onPress(checked: boolean) => voidCallback triggered when the checkbox is pressed, returning the new checked state.