Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

SVG Sprite

Security covered Under active development 28 sites

This module allows you to manage and display icons from SVG sprite files. It provides a field type to select icons from a dropdown, automatically populated from your sprite's symbol IDs. Icons can then be easily inserted into content or Twig templates.

This module adds a new field type called SVG Sprite. Using this field you can select an icon from a dropdown list which is auto-generated from a SVG Sprite file.

It reads the SVG Sprite and automatically adds every <symbol id="">...</symbol> to the list, which is typically how SVG Sprites are generated.

It outputs something similar to file.svg#symbol-id using a dedicated field formatter.

A submodule is available to allow insertion of SVG sprites in CKEditor 5 WYSIWYG editor.

A small Twig extension is also available allowing to easily add an SVG sprite into your Twig templates.

Example: {{ svg_sprite('lightbulb') }}.

You can add custom attributes to your sprite Twig function:

{{ svg_sprite('lightbulb', {'class': 'my_css_class'}) }}

This will produce:

<svg class="sprite sprite-lightbulb my_css_class"...>
  ...
</svg>

An experimental token is also available: [svg_sprite:sprite:lightbulb] but might requires to allow svg and use HTML tags rendering in some contexts like Views (XSS).

A small utility function in the SvgSpriteHelper class shows how to programmatically override the Xss::$adminTags property to allow the use of the svg and use HTML tags.

Similar or related projects

Drupal 10–11

Ask your assistant about SVG Sprite

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
17
Tracked since
Oct 2024
Latest release
7 months ago
Releases (12 mo)
4 ▼ from 6
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
1.1.5 Stable 10–11 Mar 10, 2026
1.1.4 Stable 10–11 Nov 19, 2025
1.x-dev Dev 10–11 Nov 17, 2025
1.1.3 Stable 10–11 Nov 17, 2025
1.1.2 Stable 10–11 Oct 10, 2025
1.1.1 Stable 10–11 Jan 7, 2025
1.1.0 Stable 10–11 Dec 3, 2024
1.1.x-dev Dev 10–11 Dec 3, 2024
1.0.0 Stable 10–11 Nov 6, 2024
1.0.0-beta3 Pre-release 10–11 Oct 22, 2024