0.0.2 • Published 5 years ago

@r3act/search-box v0.0.2

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

CircleCI Coverage Status Maintainability Netlify Status

Easy react search box autcomplete components .

Install

  yarn add @c4/react-search-box

Usage

Example:

  const data = [
    {name: "foo"},
    {name: "fuzz"},
    {name: "fixx"},
    {name: "bar"},
    {name: "beer"},
    {name: "blast"},
    {name: "span"},
    {name: "spazz"},
    {name: "spec"},
  ]

  // InputComponent
  function Input(props){
    return (
      <input {...props} />
    )
  }

  // Wrapper Component
  function Wrapper({children}){
    return(
      <section>
        {children}
      </section>
    )
  }

  // Item Component
  function Item(item){
    return(
      <div id="c4-searchbox-item">
        {item.name}
      </div>
    )
  }

  <Search
    InputComponent={Input}
    WrapperComponent={Wrapper}
    ItemComponent={Item}
    data={data}
    limit={10}
    searchKey={"name"}
  />

Properites

PropertyTypeDefaultDescription
InputComponentreact componentnullinput element
WrapperComponentreact componentnullelement to wrapper results
ItemComponentreact componentnullresult element
dataarray[objects][]data to be filtered
limitinteger10limit of results to will be rendered
searchKeystringnamekey that will be used in filter.

Development

run

  yarn storybook

test

  yarn test

build

  yarn build

Carlos Costa | 2019