diff --git a/snippets/MultiselectCheckbox.md b/snippets/MultiselectCheckbox.md index eabda25e7..c843c94e4 100644 --- a/snippets/MultiselectCheckbox.md +++ b/snippets/MultiselectCheckbox.md @@ -1,10 +1,11 @@ ### MultiselectCheckbox -Renders a checkbox list with the `options` provided through `props`. +Renders a checkbox list that uses a callback function to pass its selected value/values to the parent component. . -Initially, all the items in the `options` array only have label ( and / or other data provided by the user ) and `checked` is `undefined` if not provided. On clicking any of the items, the `checked` value for the item is toggled and state is updated with the new list. - -An `onChange` prop can be passed to the `MultiCheckbox` component to get the updated list on every change event within the list. +Use `React.setState()` to create a `data` state variable and set its initial value equal to the `options` prop. +Create a function `toggle` that is used to toggle the `checked` to update the `data` state variable and call the `onChange` callbac passed via the component's props. +Render a `