News
Jul 13, 2025

Interactive SVG Maps in Webflow: CMS-Driven Regions & Filters (2025 Tutorial)

Connect your CMS collection to an inline SVG, highlight regions on hover, and filter content dynamically. Includes Logic hooks and accessibility best practices.

Interactive SVG Maps in Webflow: CMS-Driven Regions & Filters (2025 Tutorial)

Published July 2025 • 10 min read

Why SVG maps?

Google Maps iframes weigh 400 kB and break Core Web Vitals. PNG maps blur on 4K screens. Inline SVGs scale perfectly, animate smoothly, and—paired with the CMS—let editors update region data without opening Figma. In 2025 Webflow finally lets you embed raw SVG code directly in the Designer, which means fully-interactive maps are now a no-code reality.

1 — Prepare the SVG

  1. Open Figma → import your vector map (e.g., US states).
  2. Flatten each region to a single <path> and give it an id that matches your CMS slug (e.g., california).
  3. Export as SVG → Outline text → Include id attributes.

Copy the raw markup to clipboard.

2 — Create the CMS collection

Collection: Regions
Fields:

  • Name (Plain text)
  • Slug (auto)
  • Highlight Color (Color)
  • Summary (Rich text)
  • Path ID (Plain text) — must equal the SVG id

3 — Embed the SVG in a Component

  1. Designer → Add → Embed → paste SVG markup.
  2. Wrap in a div .map-wrapper. Give the SVG width:100%.
  3. Add custom CSS in Page Settings:
svg path {
  fill: var(--neutral-100);
  transition: fill .2s, stroke-width .2s;
}
svg path.is-active {
  fill: var(--primary-500);
  stroke-width: 2;
}

4 — Link paths to CMS data

We’ll use Finsweet Attributes (no JS) to bind each path:

<script fs-cmsfilter-element="list" fs-cmsfilter-reset-deep></script>

But an even lighter route is Webflow Logic + native data-* attributes:

  • Add a Collection List of Regions (display:none).
  • Inside, add a <script> that runs once per item:
const path = document.getElementById("{{path-id}}");
path.dataset.region = "{{slug}}";
path.dataset.color = "{{highlight-color}}";

5 — Hover & click interactions

document.querySelectorAll('svg path').forEach(p => {
  p.addEventListener('mouseenter', () => {
    p.style.fill = p.dataset.color;
  });
  p.addEventListener('mouseleave', () => {
    if (!p.classList.contains('is-active')) p.style.fill = '';
  });
  p.addEventListener('click', () => {
    document.querySelectorAll('svg path').forEach(el => el.classList.remove('is-active'));
    p.classList.add('is-active');
    // Scroll to details card
    document.getElementById(p.dataset.region + '-card').scrollIntoView({ behavior: 'smooth' });
  });
});

JS bundle size: 2.4 kB gzipped.

6 — Render region details

Below the map, add another Collection List of Regions. Each item gets id="{{slug}}-card". Style as cards; optional Filter interaction so only the active region is shown.

7 — Accessibility considerations

  • Add role="img" aria-label="Clickable map of US states" to the <svg>.
  • Each <path> needs tabindex="0" and aria-label="{{name}}".
  • Replace mouse events with focus/keydown handlers (Enter activates a region).

8 — Performance & SEO

The inline SVG adds ~30 kB for a continental US map. Because it’s inline, it’s parsed with the first paint—no additional requests. Lighthouse impact is negligible versus PNG.

9 — Bonus: Color-by-data choropleth

const max = Math.max(...window.regions.map(r => r.value));
window.regions.forEach(r => {
  const intensity = r.value / max;
  document.getElementById(r.pathId).style.fill = `rgba(0,123,255,${intensity})`;
});

Great for pricing maps or demographic heatmaps.

Conclusion

Inline SVG maps give you retina-sharp visuals, tiny payloads, and editor-friendly content updates. Combine Webflow CMS, a sprinkle of Vanilla JS and the new Logic hooks, and you’ve got an interactive map that would have required React + D3 last year—now done entirely in Webflow.

Subscribe to our weekly newsletter

Lorem ipsum dolor sit amet consectetur mi urna tellus dignissim duis at in tempor mauris morbi fermentum dolor lobortis aliquam maecenas.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Subscribe Newsletter Image - Subscription X Webflow Template