The <collection-browser> element provides a slot with the name category as a method to navigate through, or filter the items in the collection browser.
Category elements, like the item elements, can be any element type. To make an element a category, set it's slot attribute to category.
Each category element will trigger a category event when it is clicked. It also has the default functionality of add selected to its own class list, as well as adding the class has-category to any item that matches the category's key.
Matching is done with an exact string match of the data-category attribute for each category element and each item element. For default matching, set a category element's data-category value to any value, then set an item's data-category value to that same value. When the category is clicked, the item will get a has-category class.
Items may use multiple category keys by separating them with a comma (,) character. For instance, an item with the attribute data-category="a,b,c" would match for any category that had a key of "a", "b", or "c".
Default functionality can be prevented by handling the category event and calling the preventDefault() function on the event object.
In this example, the has-category class adds a border so the filtered elements can be seen. To demonstrate multiple categories, the last three elements - J, K, and L - each use multiple categories so that they all match for category 4, but each match for another category, as well.