Prototype Library

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.

Inherited .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.