0.2.1 • Published 7 years ago
react-checked v0.2.1
ReactRadio v0.2.1
New in v0.2.*
CheckboxGroup component. This component allows you select several values and handle them in onChange function
onChange callback function. Funttion, witch handle change event.
Installation
npm install --save react-checked
Usage
import
import { RadioGroup, CheckboxGroup } from "react-checked";
RadioGroup
const options = [{
text: "One",
value: "1"
}, {
text: "Two",
value: "2"
}, {
text: "Three",
value: "3"
}];
ReactDOM.render(
<RadioGroup
value="2"
onChange={(value) => console.log(value)} // "2"
color="black"
items={options} />,
document.querySelector(".root")
);
CheckboxGroup
const options = [{
text: "One",
value: "1"
}, {
text: "Two",
value: "2"
}, {
text: "Three",
value: "3"
}];
ReactDOM.render(
<CheckboxGroup
values={["1", "3"]}
onChange={(values) => console.log(values)} // ["1", "3"]
color="green"
items={options} />,
document.querySelector(".root")
);
Options
Property | Type | Values | Default |
---|---|---|---|
color | string | "orange", "red", "green", "blue", "black" | "blue" |
onChange | function | callback function for hadling change event | () => { return } |