Skip to main content
Legend
October 21, 2025
Answered

How to create <g> elements in SVG that are recognized as layers in Illustrator

  • October 21, 2025
  • 1 reply
  • 142 views

I’m generating SVG code programmatically, with the intention of editing it later in Adobe Illustrator.

 

When I create a <g> element with an id attribute, like <g id="item 1"></g>, Illustrator recognizes it as a group named "item 1" within "Layer 1". However, I want Illustrator to recognize it as a separate layer named "item 1", not just a group.

 

Currently, I’m using an Illustrator script to convert these <g> elements into layers after importing the SVG. But is there a way to write the SVG code so that Illustrator recognizes certain <g> elements as layers from the start?

Correct answer Monika Gause

Your file opens as desired in Inkscape. From that I would conclude, that no, not possible to get Illustrator to interpret the structure like you want.

 

SVGs do not have a layer element, so it will be difficult for any application to figure out what the user intended.

 

PLease make a feature request: https://illustrator.uservoice.com

1 reply

Monika Gause
Community Expert
Monika GauseCommunity ExpertCorrect answer
Community Expert
October 21, 2025

Your file opens as desired in Inkscape. From that I would conclude, that no, not possible to get Illustrator to interpret the structure like you want.

 

SVGs do not have a layer element, so it will be difficult for any application to figure out what the user intended.

 

PLease make a feature request: https://illustrator.uservoice.com

sttk3Author
Legend
October 21, 2025

Thank you for your response. The structure appears as intended in applications like Adobe XD and Figma as well. It seems that the absence of a distinction between groups and layers in those applications works to our advantage.

 

In other words, when importing an SVG into Illustrator—which does distinguish between groups and layers—the user's intent regarding that distinction needs to be explicitly indicated.