Coder Social home page Coder Social logo

tanstack / select Goto Github PK

View Code? Open in Web Editor NEW
176.0 5.0 19.0 292 KB

๐Ÿค– Powerful select, multi-select and autocomplete primitives for the web. TS/JS, React, Solid, Svelte and Vue.

JavaScript 100.00%
react select multi-select autocomplete auto-fill

select's People

Contributors

dependabot[bot] avatar tannerlinsley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

select's Issues

ReferenceError: regeneratorRuntime is not defined

Hi, I try to test your hook in Next.js but I got this error. Could you ship your hook in a none transpiled version too?

ReferenceError: regeneratorRuntime is not defined
useDebounce
/mnt/ssd/repositories/test/ui/node_modules/use-select/dist/index.js:193:3
useSelect
/mnt/ssd/repositories/test/ui/node_modules/use-select/dist/index.js:392:27
MySelect
./components/MySelect.js:10
   7 | const optionsRef = useRef();
   8 | 
   9 | // Use useSelect to manage select state
> 10 | const {
     | ^  11 |   visibleOptions,
  12 |   selectedOption,
  13 |   highlightedOption,

search always returns empty list

I have everything working with use-select except the search.

When I use the setSearch function like so:

<input
    type="text"
    name="search"
    autoComplete="off"
    onChange={(e) => {
      setSearch(e.target.value);
    }}
    className="focus:ring-indigo-500 focus:border-indigo-500 block w-full pl-9 sm:text-sm border-gray-300 rounded-md"
    placeholder="Search"
  />

visibleOptions always returns an empty array, no matter what I search for.

Also I try to override the filterFn like so:

  const searchFilter = (options, searchValue) => {
    console.log(options, searchValue);
    return options;
  };
const {
    visibleOptions,
    selectedOption,
    getInputProps,
    getOptionProps,
    isOpen,
    setOpen,
    setSearch,
    searchValue,
  } = useSelect({
    multi: true,
    options,
    value,
    onChange,
    optionsRef,
    filterFn: (options, searchValue) => searchFilter(options, searchValue),
  });

the searchFilter function is never called (it never logs anything).

Thank you for made this

Just want to say thank you so much for made this dont understand why this pack dont have many stars.
Btw can i use async api with use select?

typescript definition

thanks for your good hook

would you want to add a typescript definition to it or convert it to typescript fro base?

I would be happy to do that with a PR

Disable/optimize virtualised list

The "virtualised" list feature definitely makes sense for big lists. However, compared to e.g. react-virtualised this behaviour feels very sluggish/slow, even if you are just hovering over individual options in the list (might be also just me).

I assume it might be difficult to optimise the "virtualised" list, i.e. react-window, but simpler to disable this functionality for e.g. smaller lists. Should this be an option?

How can remove styled-components?

Hi I just want custom for all input tag, div,... but I just want use class name. I try to remove styled-components but it will be error... Can you please make a super simple of this?

Library bugs and improvements

Hey, thanks for the wonderful library. I could almost solve all my usecases. I found a few bugs and improvements that are possible.

Bugs:

  1. highlightedOption is mentioned in the API, but it is not currently exposed. It is missed in this commit during the reimplementation with index.

  2. In the Docs, there is a small typo

image

Improvements:

  1. Currently, the entire options list is filtered and the result is shown. I would like to add another behaviour where instead of filtering, the list would scroll to the actual index of the first matching element. This is also a widely used approach (react-select) and I believe this would not degrade any existing functionality.

select gif

  1. Having a ghost element that populates the label of the selected element.
    populate

This also can be achieved through a prop without degrading the existing functionality.

Please let me know if these are aligned with your vision for this library. If so we can discuss about the props and I can raise a PR as needed. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.