Menu

1 / 2

SVG to JSX and CSS Data URI: What Actually Breaks When You Inline Icons

DEV Community: css·Kevin·9 days ago
#omG2ZkJl
#devtocss#devto#dev#grad#clip0_1_2
Long article (1316 words) — no AI summary yet.
Reading 0:00
15s threshold

Pasting an exported .svg from Figma, Illustrator, or an AI generator straight into a React component or a CSS background-image almost never works on the first try. Usually one of two things happens: TypeScript yells about kebab-case attributes, or the browser renders an invisible blank box with zero console errors.

Here are the seven failure modes that actually break inlined icons in production, along with the minimal fix for each.

1. Hyphenated SVG attributes fail in React JSX and TypeScript

Standard SVG XML uses kebab-case attributes like stroke-width , stroke-linecap , fill-rule , and clip-path .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.