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
TL;DR: I want to remove and add items found in the overflow menu state manually OR force it to re-render when a method runs so it's updated. I found that I can see them in the useOverflowVisibility() hook, but not that I can change them in any way. Is there another way to handle the overflow state somehow?
Hi,
I'm working on a project where we have a use-case where our users should be able to select a number of items from a dialog menu, and have tags generated once they click a "Select" button in that dialog. When the tags are displayed, they should be shown in an overflow-format whenever they reach the maximum allowed width, like shown in the documentation.
This all works completely fine. At this point, I'm using the useOverflowMenu() hook to use the overflowCount and isOverflowing parameters from there.
I also need to be able to remove tags both from the ones that are visible, and those that are shown in the overflow menu. This is a bit more problematic since the overflow menu won't re-render when I remove an item from it. So the overflowCount parameter doesn't display the new correct number of overflow items, but I added a separate state to handle this myself, so that was fine too.
Here comes the issue that I can't seem to find a solution to: I also need to be able to uncheck tags that are already displayed on the main page from my dialog box. When I unselect one of the items in the overflow menu, it doesn't update the overflow menu context which means that it will show an incorrect amount of "overflow" items in the list (once again: overflowCount is not updated). I wanted to find a workaround and looked in the source code where I found the useOverflowContainer which might've worked, but I can't use it since it's internal, and may not be the right way to do it in the first place.
Is there another way I can handle the overflow menu state to remove and add items manually?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR: I want to remove and add items found in the overflow menu state manually OR force it to re-render when a method runs so it's updated. I found that I can see them in the useOverflowVisibility() hook, but not that I can change them in any way. Is there another way to handle the overflow state somehow?
Hi,
I'm working on a project where we have a use-case where our users should be able to select a number of items from a dialog menu, and have tags generated once they click a "Select" button in that dialog. When the tags are displayed, they should be shown in an overflow-format whenever they reach the maximum allowed width, like shown in the documentation.

This all works completely fine. At this point, I'm using the
useOverflowMenu()
hook to use theoverflowCount
andisOverflowing
parameters from there.I also need to be able to remove tags both from the ones that are visible, and those that are shown in the overflow menu. This is a bit more problematic since the overflow menu won't re-render when I remove an item from it. So the
overflowCount
parameter doesn't display the new correct number of overflow items, but I added a separate state to handle this myself, so that was fine too.Here comes the issue that I can't seem to find a solution to: I also need to be able to uncheck tags that are already displayed on the main page from my dialog box. When I unselect one of the items in the overflow menu, it doesn't update the overflow menu context which means that it will show an incorrect amount of "overflow" items in the list (once again:
overflowCount
is not updated). I wanted to find a workaround and looked in the source code where I found the useOverflowContainer which might've worked, but I can't use it since it's internal, and may not be the right way to do it in the first place.Is there another way I can handle the overflow menu state to remove and add items manually?
Beta Was this translation helpful? Give feedback.
All reactions