0.1.0 • Published 25 days ago

@sefirosweb/react-multiple-search v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
25 days ago

React Multiple Search Input

"Buy Me A Coffee"

"Storybook" TypeScript

It´s a React compononet to use a multiple searchs or filters in one input, but you can specific in wich field you want to search

Try it!

How to use all components are in the GitHub Pages

image

Install

npm install --save-dev @sefirosweb/react-multiple-search

Usage

Import components whant you wish:

import { useEffect, useRef, useState } from "react";
import InputSearch, {
  InputSearchPropsRef,
  FilterLabel,
  Filters,
} from "@sefirosweb/react-multiple-search";
function App() {
  const inputRef = useRef<InputSearchPropsRef>(null);
  const [filter, setFilter] = useState<Array<Filters>>([]);
  const initialFilterLabels: Array<FilterLabel> = [
    {
      label: "All",
      filter: "all",
    },
    {
      label: "Name",
      filter: "name",
    },
    {
      label: "Email",
      filter: "email",
    },
  ];

  useEffect(() => {
    const time = setTimeout(() => {
      inputRef.current?.inputRef?.focus();
    }, 1000);
    return () => clearTimeout(time);
  }, []);

  return (
    <div>
      <div style={{ margin: "30px" }}>
        {JSON.stringify(filter)}
        <InputSearch
          ref={inputRef}
          filters={filter}
          setFilters={setFilter}
          filterLabels={initialFilterLabels}
        />
      </div>
    </div>
  );
}

export default App;

Contribute to this project in github.com/sefirosweb/react-multiple-search

0.1.0

25 days ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago