1.0.2 • Published 2 years ago

react-radio-checkbox-2z v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description
  • You can customize icon, theme or color for Checkbox/Radio
  • Single option
  • It is not react-radio-checkbox-z
Usage
npm install --save react-radio-checkbox-2z

Import the module in the place you want to use:

import RadioOrCbx from "react-radio-checkbox-2z";

Snippet

    const [value, setValue] = useState('label1') // radio
    // const [value, setValue] = useState(['label1']) // radio || checkbox

    <RadioOrCbx optionLabel='abcd1' optionValue='ab1' value={value} onChange={setValue} />

    <RadioOrCbx optionLabel='abcd2' optionValue='ab2' value={value} onChange={setValue} />

    // Customize label
    <RadioOrCbx optionValue='ds2' value={value} onChange={setValue}>Label</RadioOrCbx>
Props
propstypedescription
idString
themeStringdefault: tick
classNameStringcss
disabledboolean
boxSizenumberdefault: 16
typeCheckboxbooleandefault: false (it is radio)
floatRightbooleandefault: false (Check in left)
isRectbooleandefault: false (Checkbox is circle)
groupNameStringgroupName of radio/checkbox
selectColorStringdefault #4169E1 (color when checked)
unSelectColorStringdefault #cbd1d8 (color when unchecked)
hoverColorStringdefault use selectColor (Color when hover)
tabFocusColorStringdefault #000000. Box shadow color when focus
tickColorStringColor of tick when check.
checkedIconCustomize icon. (Change your icon checked)
optionLabelDisplay label text
optionValueValue option (string or number)
valueSingle, ArrayCurrent selected value
onChangefuncEvent change
...propsanyProp of input. (It's not necessary)
Note

Theme 'fill', 'in', 'out', 'tick', 'tick-fill', 'tick-fill-in', 'x', 'x-fill', 'x-fill-in'

Example

LIVE EXAMPLE

A working example can be found in the example directory.

npm install
npm run dev
npm run start

License

MIT