Connect your CMS collection to an inline SVG, highlight regions on hover, and filter content dynamically. Includes Logic hooks and accessibility best practices.
Published July 2025 • 10 min read
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.
<path>
and give it an id
that matches your CMS slug (e.g., california
).Copy the raw markup to clipboard.
Collection: Regions
Fields:
Name
(Plain text)Slug
(auto)Highlight Color
(Color)Summary
(Rich text)Path ID
(Plain text) — must equal the SVG id
.map-wrapper
. Give the SVG width:100%
.svg path {
fill: var(--neutral-100);
transition: fill .2s, stroke-width .2s;
}
svg path.is-active {
fill: var(--primary-500);
stroke-width: 2;
}
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:
<script>
that runs once per item:const path = document.getElementById("{{path-id}}");
path.dataset.region = "{{slug}}";
path.dataset.color = "{{highlight-color}}";
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.
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.
role="img" aria-label="Clickable map of US states"
to the <svg>
.<path>
needs tabindex="0"
and aria-label="{{name}}"
.focus
/keydown
handlers (Enter activates a region).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.
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.
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.
Lorem ipsum dolor sit amet consectetur mi urna tellus dignissim duis at in tempor mauris morbi fermentum dolor lobortis aliquam maecenas.