Jetpack Compose draws vectors as an ImageVector, not as SVG or XML. This converts the SVG above into a Kotlin ImageVector — the builder plus a path DSL — exposed as a val you can hand straight to Icon or Image. There's no res/drawable file and no XML to maintain, and it all happens in your browser.
How to convert an SVG to Compose
- Load your SVG above, or edit the curved sample. It stays in your browser.
- Open the Code tab and choose Jetpack Compose.
- Set the name — it becomes the val and the builder name.
- Copy the Kotlin, or download
Name.kt.
What the code looks like
- An
ImageVector.Builderwith defaultWidth and defaultHeight in dp and viewportWidth/Height taken from the viewBox. - One
path { }block per shape, its geometry expanded to the DSL:moveTo,lineTo,curveTo,quadTo,close. SolidColorfills and, where present, a stroke with width, cap, and join.- A lazily built, cached
val— the pattern the Material icons use — so referencing the imagevector stays cheap.
When to reach for an ImageVector
Keeping icons in Kotlin removes the XML round-trip and lets small, tweakable vectors sit next to the code that draws them — handy for a design system or a screen with a few bespoke glyphs. The unsupported list matches the VectorDrawable route: gradients, masks, clip paths, filters, text, and images are dropped and reported, because a compose path describes solid fills and strokes rather than a full SVG feature set.