Skip to main content

Filter pill

Toggle a facet filter, or show an applied one.

Snowflake PostgreSQL
Snowflake
<div role="group" aria-label="Provider">
<mm-filter-pill count="1284" pressed>
<mm-provider-logo slot="start" provider="snowflake" size="14" decorative></mm-provider-logo>Snowflake
</mm-filter-pill>
<mm-filter-pill count="412">PostgreSQL</mm-filter-pill>
</div>
<mm-filter-pill removable facet="Provider">Snowflake</mm-filter-pill>

Guidance​

Filter pills toggle facets in Discover and list views, such as a provider or a tag. They are round, mm-surface with an mm-rule border that darkens on hover; a pressed pill is inverted ink. The optional count sits in mono with tabular figures. With removable, the pill shows an applied filter (“Provider: Snowflake”) with a remove button, for active-filter rows above results; move focus to the next pill or the search field when you remove it.

Keyboard follows the WAI-ARIA toggle button pattern (https://www.w3.org/WAI/ARIA/apg/patterns/button/): Enter and Space toggle.

Properties​

PropertyAttributeTypeDefaultDescription
pressedpressedbooleanfalseWhether the facet is applied (toggle mode).
countcountnumber | undefinedNumber of matching results, shown in mono.
facetfacetstring''Facet name shown before the value in a removable pill, such as “Provider”.
removableremovablebooleanfalseShows an applied filter with a remove button instead of a toggle.
disableddisabledbooleanfalse

Events​

EventDetailDescription
mm-changeCustomEvent<{ pressed: boolean }>The pill was toggled.
mm-removeCustomEvent<Record<string, never>>The remove button of a removable pill was activated.

Slots​

SlotDescription
DefaultThe label.
startA leading <mm-provider-logo> or <mm-icon>.

CSS parts​

PartDescription
pillThe pill (the toggle button, or the wrapper when removable).
countThe count.
removeThe remove button.

Examples​

Every state of mm-filter-pill in Storybook, with keyboard and screen reader tests.