You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be really easy to use as the Item's values should be handled by the Dropdown itself.
This approach would allow nearly anything as one could use a ref to the items to modify their value.
This could be implemented by using React's context API for instance.
The advantage of the first approach would be that there would be nearly no limitations but it would mean that the user would need to write some of the logic himself.
The second approach would be a lot more clean and simple but would then again create some limitations as you would be forced to use <Dropdown.Item>.
What do you think about this?
The text was updated successfully, but these errors were encountered:
Ultimately, this is beyond the scope of the component. I don't think there is a common enough use case for it.
Interacting with child components is not supported. We plan to remove the ability to pass children in the future. Instead, we'll likely have some kind of menu prop and/or items prop. See #1757 for the latest thoughts. You can also search our issues for "RFC Dropdown".
This would mean that the users would have to implement the selection logic theirselves but would add a lot of flexibility
This is one of the main reasons we plan to pull all support for children. It is not practical to implement this logic on your own. The Dropdown is ~1,300 lines, almost all of which deals with the logic for handling the menu and the items.
Workaround
You may be able to use the content prop to render a more complex child in the item if you wish.
I would like to create a dropdown with controlled children.
An example case would be a multiselection dropdown with checkboxes.
I have two suggestions to make this possible:
Pass control properties to the direct child
This would mean that the users would have to implement the selection logic theirselves but would add a lot of flexibility.
This line could be edited to pass the props down.
Semantic-UI-React/src/modules/Dropdown/Dropdown.js
Line 1185 in 292c595
Handle <Dropdown.Item /> children
This would be really easy to use as the Item's values should be handled by the Dropdown itself.
This approach would allow nearly anything as one could use a ref to the items to modify their value.
This could be implemented by using React's context API for instance.
The advantage of the first approach would be that there would be nearly no limitations but it would mean that the user would need to write some of the logic himself.
The second approach would be a lot more clean and simple but would then again create some limitations as you would be forced to use <Dropdown.Item>.
What do you think about this?
The text was updated successfully, but these errors were encountered: