You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set exported SVG tag ID to its source layer name #2879
When exporting to SVG no node id is created; this should be set to the layer name so that the id becomes available for other tools, e.g. styling, animation with SVG. Figma does this (set the checkbox on Export, screenshot).
@hollermay you can open a PR that tags this issue. We'll assign you to the issue once you've successfully completed it and the PR is merged.
As a note, you'll want to only have the layer name show in the ID field when exporting, not normally. There is a render options struct that has that flag you can use to pick when to include it. Be sure to escape invalid characters in an ID.
Adding an id attribute to the container SVG tag? That would be useless (or even bad). The requested behavior here is, as you show in your screenshot, ids given to each named layer. Deduplicated (they must be unique) with suffix numbers if needed, and skipped if unnamed.
Activity
hollermay commentedon Jul 20, 2025
Would like to work on this please assign me this issue.
Keavon commentedon Jul 28, 2025
@hollermay you can open a PR that tags this issue. We'll assign you to the issue once you've successfully completed it and the PR is merged.
As a note, you'll want to only have the layer name show in the ID field when exporting, not normally. There is a render options struct that has that flag you can use to pick when to include it. Be sure to escape invalid characters in an ID.
[-]Set node id in SVG to layer name[/-][+]Set exported SVG tag ID to its source layer name[/+]partg952 commentedon Nov 1, 2025
is this issue still open for fix?
Keavon commentedon Nov 1, 2025
Yes. See the discussion above for useful info, also.
partg952 commentedon Nov 1, 2025
so this is an svg exported from figma so are we supposed add id to the children too , or just the svg tag must have the id attribute?
Keavon commentedon Nov 1, 2025
Adding an
idattribute to the container SVG tag? That would be useless (or even bad). The requested behavior here is, as you show in your screenshot,ids given to each named layer. Deduplicated (they must be unique) with suffix numbers if needed, and skipped if unnamed.partg952 commentedon Nov 2, 2025
Oh okay, different layers in an svg must be given an id?
kebjs commentedon Nov 3, 2025
Below a more complete Figma example export including Frame, Groups, duplicate names.
All
idtags are relevantgtag to handle grouped objects, e.g. to hide/show them completelyrectto manipulate this object, e.g. assign an actionmy:squareandmy:square_2(dedup as mentioned above)Filename as set by Figma from the frame
example-grouping.svgfeat: Set exported SVG tag ID to its source layer name
feat: Set exported SVG tag ID to its source layer name