Skip to main content

Checkbox

The Checkbox component in our library is a user interface element used to enable users to select or deselect options. It typically appears as a small box that can be checked or unchecked, indicating the state of the option. Checkboxes are commonly used in forms, settings, or list items where users need to make multiple selections from a list of options.

Usage

Basic usage

import React from 'react';

import {CheckBox} from 'rn-inkpad';

const MyComponent = () => {
return <CheckBox />;
};

Props

NameTypeDefaultDescription
checkedIconstringcheckbox-outlineIcon when selected.
checkedbooleanfalseEnable/disable selection.
iconColorstring#464EE5Checkbox color.
iconSizenumber20Checkbox size.
styleStyleProp<ViewStyle>Personalized styles for your checkbox.
textColorstringText color.
textStyleStyleProp<TextStyle>Personalized styles for checkbox text.
titlestringItemCheckbox text.
unCheckedIconstringsquare-outlineIcon when unselected.
onChange(value: boolean) => voidFunction that captures the current value of the checkbox.

Usage with props

import React, {useState} from 'react';
import {Text, View} from 'react-native';

import {CheckBox} from 'rn-inkpad';

const MyComponent = () => {
const [checked, setIsChecked] = useState(false);

return (
<View>
<CheckBox
checked={checked}
iconColor={'#DB504A'}
iconSize={25}
textStyle={{fontSize: 20}}
onChange={setIsChecked}
title={'Item 1'}
/>

<Text style={{marginTop: 10, fontWeight: '700'}}>
{checked ? 'Checked' : 'Unchecked'}
</Text>
</View>
);
};

Example with props