Skip to main content
Version: 1.x

CheckBox

The CheckBox component is a UI element that allows the user to toggle between two states: checked and unchecked.

Import

import { CheckBox } from '@tra-tech/react-native-kitra';

Usage

import { CheckBox } from '@tra-tech/react-native-kitra';
import { useState } from 'react';
import { View } from 'react-native';

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

return (
<View style={{ justifyContent: 'center', flex: 1 }}>
<CheckBox
style={{ alignSelf: 'center' }}
value={value}
onChange={event => console.log(event)}
onPress={() => setValue(prev => !prev)}
iconColor="red"
/>
</View>
);
};

export default App;

Props

Prop nameTypeRequiredDescription
valuebooleanNoDetermines whether the checkbox is checked or unchecked
onChange(value: boolean) => voidNoA callback function that is called when the checkbox is pressed, with the new state value as an argument
styleStyleProp<ViewStyle>NoAdditional styles to apply to the checkbox container
disabledbooleanNoDetermines whether the checkbox is disabled or not
iconColorstringNoThe color of the checkmark icon
themeUIThemeNoAn object containing the color palette used for the checkbox
...TouchableOpacityProps...TouchableOpacityPropsNoAny additional props to be passed to the underlying TouchableOpacity component.