Next, I added two events — one called “check” and another called “not visible.” The check event is triggered when an item in the unchecked state is clicked. This interaction changes the variant of the clicked item and marks it as selected.
The main filter component includes the item list, this component has two states: visible and not visible. The visible state is when the menu is expanded and all the items are shown. Once an item is selected, the “not visible” event is triggered, which closes the menu and brings it back to its original button form.