1. resources
  2. cookbook
  3. svg filters

SVG Filters

Apply filter effects to elements and images.

How It Works

This feature is enabled by SVG filters paired with feColorMatrix transformations.

Minimal Example

The SVG controls the filter settings. The filter is applied using filter: url(#Emerald) and linking the SVG’s unique ID.

Create a Filter

We recommend SVG Color Matrix Mixer by Rik Schennink to create your own filters.

From Skeleton

Skeleton provides a collection of open source SVG filters. Pull requests welcome!

Previews

Tips

  • The SVG must be in the same scope as the elements being filtering.
  • Consder storing your SVGs witin your local project for quick and reusable imports.
  • All Vite-based frameworks support .svg imports.
  • Optionally you can embed the SVG within a component (ex: .svelte, .tsx), then import that.
  • Filter SVGs are affected by the flow DOM, including class styles such as space-{x|y}.