GitHub

Filter Clear Button

Ghost/link-style button that clears all active filters. Optional leading filter-x icon, customizable label, and a bubbling esa-filter-clear event on click.

Stable .astro import EsaFilterClearButton from '@esa/ecology/esa-filter-clear-button.astro';

Preview

<FilterClearButton />

Variants

Override the label, and drop the icon for a plain link-style action.

<FilterClearButton label="Reset filters" />
<FilterClearButton label="Clear all" showIcon={false} />

API

PropTypeDefaultDescription
label string 'Clear all' Visible button text.
showIcon boolean true Show the leading filter-x icon.
hidden boolean false Suppress rendering entirely (renders no DOM).

Events

PropTypeDefaultDescription
esa-filter-clear (no detail) — Bubbling/composed. Fires on click so a parent container can clear all active filters.

Accessibility

  • Renders a native <button> with a fixed aria-label="Clear all filters", so the name is stable even when label changes.
  • The leading icon is aria-hidden — decorative only.
  • Hover applies a subtle overlay; focus-visible shows a 2px primary outline via --focus-ring-* tokens.

Theming surface

Every public token this component reads, extracted from its source at build time, split by blast radius: the hooks that belong to this component, then the shared and system tokens it consumes alongside everything else. The Resolves to column walks each token's real lineage — component → semantic → primitive → raw value — so you can see exactly where re-pointing it lands. A spoke re-skins by overriding these in its theme-<slug>.css; component internals are never edited. No hook for what you need? File it with /request-lego.

Type roles it names

This component does not set a size, weight, face or tracking of its own — it names a composite, and the composite carries all five. A composite is a class rather than a token, so none of it appears in the tables below; re-theme text by re-pointing the token family, not by editing the component.

RoleRe-pointReach
.typography-microcopy-sm
  • --typography-microcopy-sm-font-family 'DM Sans', sans-serif via --typography-font-family-sans → --font-family-dm-sans
  • --typography-microcopy-sm-font-size clamp(0.6875rem, 0.61rem + 0.38vw, 0.875rem) via --font-size-150
  • --typography-microcopy-sm-font-weight 500 via --typography-font-weight-medium → --font-weight-500
  • --typography-microcopy-sm-letter-spacing 0.01em via --letter-spacing-default
  • --typography-microcopy-sm-line-height 1 via --line-height-none
+3 more components esa-filter-dropdown, esa-pill, esa-sidebar-nav

Wired to this component

None. This component has no hooks of its own — it themes entirely through the shared tokens below, so every override here also moves its siblings.

Shared tokens it reads

Owned by a family or by the semantic layer. Still overridable — but scope the override (esa-foo { --form-border-color: … }) unless you mean to move everything that reads it. Reach says what else that is.

Token Reach Resolves to
--focus-ring-color component focus ring group · +34 more #3e9b4f via --color-border-default-focus → --color-grass-10
--focus-ring-offset component focus ring group · +31 more 2px
--focus-ring-width component focus ring group · +35 more 2px via --border-width-focus → --border-width-200
--color-background-overlay-hover semantic every component rgba(0, 0, 0, 0.03)
--color-content-default-secondary semantic every component #646464 via --color-gray-11
--color-content-utility-danger semantic every component #ce2c31 via --color-red-11
--radius-sm semantic every component 0.25rem via --radius-100
--transition-fast semantic every component 150ms via --duration-150
--spacing-100 primitive every component 0.25rem
--spacing-200 primitive every component 0.5rem