diff --git a/docs/components/Set.md b/docs/components/Set.md index a6d8700a..17b29f91 100644 --- a/docs/components/Set.md +++ b/docs/components/Set.md @@ -1,5 +1,53 @@ # Set -// TODO: :disappointed_relieved: +The Set component is used to work with an array of unique values. -Send us a PR if you want to collaborate! :green_heart: +```js +import { Set } from 'react-powerplug' +``` + +```jsx + + {({ values, remove, add }) => ( + + + {values.map(tag => ( + remove(tag)}>{tag} + ))} + + )} + +``` + +## Set Props + +**initial = []** _(optional)_ +Specifies the initial values state, must be an array. Duplicate items will be removed. +By default, the initial values state is an empty array. + +**onChange** _(optional)_ +The onChange event of the Set is called whenever the values state changes. + +## Set Children Props + +TL;DR: `{ values, add, clear, remove, has }` + +**values** +`array` +Your values state, contains only unique items + +**add** +`(value: any) => void` +Add a unique `value` to your values array. Does nothing if values array already includes a `value`. + +**clear** +`() => any` +Reset values state to an empty array + +**remove** +`(value: any) => void` +Remove a `value` from your values array + +**has** +`(value: any) => boolean` +True if values array includes a `value` \ No newline at end of file