Open quangdaon opened 3 months ago
Yeah, when you have two completely different UI implementations the easiest approach is to show one or the other based on the breakpoint, but you'd want to have the selected item kept in sync. I'll try and come up with an example based on your
Is there a recommended approach to dynamically switching the selector style across multiple breakpoints? Specifically, I'd like to use the "Tabs" component while in desktop but switch to a "Listbox" on mobile.
I originally used both
createListbox
andcreateTabs
to manage separate components, and used a writable store to try to synchronize the selected value, but that didn't work. I also tried to keep the selected value synchronized through event listeners, which worked for updating the listbox when the tabs is changed, but not for the reverse. What ultimately ended up working was using a singlecreateListbox
to control both elements and just styling the desktop view to look like tabs, but this seems hacky.