SVG Sprite
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
- SVG Icon
- SVG Sprite Icon Field (obsolete)
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
Release Timeline
Releases
| Version | Type | Core | Notes | 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 | ||
| 1.0.0-beta2 | Pre-release | 10–11 | Oct 14, 2024 | ||
| 1.0.0-beta1 | Pre-release | 10–11 | Oct 14, 2024 | ||
| 1.0.0-alpha4 | Pre-release | 10–11 | Oct 11, 2024 | ||
| 1.0.0-alpha3 | Pre-release | 10–11 | Oct 10, 2024 | ||
| 1.0.0-alpha2 | Pre-release | 10–11 | Oct 10, 2024 | ||
| 1.0.0-alpha1 | Pre-release | 10–11 | Oct 9, 2024 | ||
| 1.0.x-dev | Dev | 10–11 | Oct 9, 2024 |