CloudCannon/pagefind

Sort ModularUI FilterPills

ColeDCrawford opened this issue · 2 comments

FilterPills can take an ordering array. How would one sort those based on the filter count, so the most used items appear at the top?

Is there a way to customize the display of the pills, for example making them into a more standard dropdown list?

bglw commented

No trivial way to do the former, nothing exists in that component for the latter. But the goal of the Modular UI is that new cases can be addressed by creating new modules, rather than adding to existing modules.

Copying the filterPills.js file and making some tweaks would be the best step (until more "official" modules are added). Then your own class can be passed to the instance.add function of the Modular UI.

bglw commented

(I'll look at adding an option for that sorting next time I'm in the file though, that's a good call)