The canonical addon pattern: a search icon in the prefix slot, a clear button in the suffix slot. The button uses the built-in 'clear' preset — no handler code required.

Live Demo

Material Material
Loading live example

Config (for the active adapter)

{
  key: 'search',
  type: 'input',
  label: 'Search',
  addons: [
    { slot: 'prefix', kind: 'mat-icon', icon: 'search', ariaLabel: 'Search' },
    { slot: 'suffix', kind: 'mat-button', icon: 'close', ariaLabel: 'Clear', preset: 'clear' },
  ],
}