Skip to content

Tagged layers

ai2svelte allows users to create tagged layers in their Illustrator documents. Tagged layers are special layers that ai2svelte recognizes and processes differently during the export process.

To create a tagged layer, add a specific tag to the end of the layer name in Illustrator. For example, to designate a layer for SVG export, name it layer_name:svg.


Layers with the :div suffix will render rectangles and circles as scaling <div> elements in the final output. This enables responsive layouts, allowing these shapes to scale with the viewport size.

Layers with the :symbol suffix will render rectangles and circles as non-scaling <div> elements. These shapes will retain their original size and position, regardless of viewport changes.

Layers with the :png suffix will have their contents exported as PNG images, which are then included as separate <img> tags in the output. Use this tag for rasterized portions of your artwork that require special handling.

You can also use the :png24 suffix to export higher-quality PNG images with better color depth.

Layers with the :svg suffix will have their contents exported as SVG images and embedded as SVG in the final output. This is ideal for vector graphics that need to remain crisp at any size.

:text tagged layers allow users to input the text content programmatically by using the taggedText prop. The taggedText prop is an object with keys text and htext with each containing keys as the layer names (without the :text suffix) and housing key value pairs for each text object in the layer.

:htext tagged layers function similarly to :text layers but render the text as HTML content wrapped inside the svelte’s @html directive. This allows for more complex formatting and styling options.

In addition to layer tags, you can apply special directives to artboard names to control export behavior.

For example, naming an artboard Artboard1:600,fixed sets its responsiveness to fixed and displays it only when the viewport width is at least 600 pixels.

Naming an artboard Artboard2:image_only exports only the image content, omitting any text or other elements.