Skip to content

How to access the search filtered results? #4767

Answered by Rall3n
hermbo asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @hermbo,

the Select component has a method called getFocusableOptions which returns all options which are currently visible inside the list.
Be aware that the function only returns the options if the menu is open.

const MySelect = () => {
  const selectRef = useRef(null);
  
  // Use selectRef.select.getFocusableOptions() to access options.

  return <Select ref={selectRef} />;
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hermbo
Comment options

@Rall3n
Comment options

Answer selected by hermbo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants