Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiInput preselected options #1289

Open
sushiljain1989 opened this issue Jan 13, 2021 · 2 comments
Open

MultiInput preselected options #1289

sushiljain1989 opened this issue Jan 13, 2021 · 2 comments

Comments

@sushiljain1989
Copy link

Description

I want to pass the list of selected options in props but I don't see an option for that.
If I am missing something or the functionality itself is missing>

Versions

fundamental-react:

0.13.1
NOTE: Where applicable, please include uncropped screen captures.

DISCLAIMER:
After triaging an issue, the fundamental-react team will see if it can be reproduced or confirmed. If more information is needed, the fundamental-react team will contact the author. Any issues awaiting responses from the author for more than 7 days will be closed. The author can re-open the issue at a later time if they can present the requested information.

@github-actions
Copy link

Hello @sushiljain1989, thank you for using fundamental-react! The fundamental-react team will triage your issue as soon as possible.

@Jonasdoubleyou
Copy link

I'm having the same problem. A fully controlled component would be nice. I'm currently using this workaround which is super hacky:

function Parent() {
  const [selectedItems, setSelectedItems] = useState<string[]>([]);
  const multiInputRef = React.useRef<MultiInput>();

  React.useEffect(() => {
    multiInputRef.current?.setState({ tags: selectedItems });
  }, [selectedItems]);

  return <MultiInput ref={multiInputRef} onTagsUpdate={setSelectedItems} />;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants