Knowit.Umbraco.SvgPicker
1.0.1
dotnet add package Knowit.Umbraco.SvgPicker --version 1.0.1
NuGet\Install-Package Knowit.Umbraco.SvgPicker -Version 1.0.1
<PackageReference Include="Knowit.Umbraco.SvgPicker" Version="1.0.1" />
<PackageVersion Include="Knowit.Umbraco.SvgPicker" Version="1.0.1" />
<PackageReference Include="Knowit.Umbraco.SvgPicker" />
paket add Knowit.Umbraco.SvgPicker --version 1.0.1
#r "nuget: Knowit.Umbraco.SvgPicker, 1.0.1"
#:package Knowit.Umbraco.SvgPicker@1.0.1
#addin nuget:?package=Knowit.Umbraco.SvgPicker&version=1.0.1
#tool nuget:?package=Knowit.Umbraco.SvgPicker&version=1.0.1
Knowit.Umbraco.SvgPicker
A property editor for Umbraco 17 that lets editors pick SVG symbols from a spritesheet. The selected symbol renders as <svg><use>, performant, browser-cached, and design-system safe.
Editors only pick from symbols a designer has built into the sprite. No arbitrary SVG uploads, no inline styles, no broken proportions.
Requirements
- Umbraco 17 or later
- .NET 10
- An SVG spritesheet with
<symbol>elements (typically generated by your frontend build, e.g. Vite with@spiriit/vite-plugin-svg-spritemap)
Installation
dotnet add package Knowit.Umbraco.SvgPicker
No changes to Program.cs needed. The package registers itself on startup.
Setup
1. Create a data type
Settings → Data Types → Create → select SVG Picker as the property editor.
| Setting | Description |
|---|---|
| SVG Sprite Path | Absolute URL to your spritesheet, e.g. /assets/svg/sprite.svg |
| Picker Title | Optional label shown above the icon grid |
2. Add to a document type
Add the data type as a property on any document type.
3. Render in Razor
Add the using directive to Views/_ViewImports.cshtml:
@using Knowit.Umbraco.SvgPicker.Extensions
Then render:
@* Default sprite path (/assets/svg/sprite.svg) *@
@Html.SvgIcon(Model.Value<string>("icon"))
@* With a CSS class *@
@Html.SvgIcon(Model.Value<string>("icon"), "w-6 h-6")
@* With an explicit sprite path *@
@Html.SvgIcon(Model.Value<string>("icon"), "w-6 h-6", "/assets/svg/icons.svg")
This renders:
<svg class="w-6 h-6" aria-hidden="true">
<use href="/assets/svg/sprite.svg#icon-home"></use>
</svg>
How it works
Only the symbol ID (e.g. icon-home) is stored as a plain string. The spritesheet is fetched once by the browser and cached; all <use> references are near-zero cost after that.
The backoffice picker fetches your spritesheet, parses all <symbol> elements, and shows them in a searchable visual grid so editors always know what they're selecting.
Credits
This package continues a lineage of SVG symbol pickers for Umbraco:
- Umbraco.SvgIconPicker by Søren Kottal, the original concept from 2016
- InlineSvgPicker by Lynne Finnigan, an updated variant based on the above, maintained until 2022
This package reimplements the same concept for Umbraco 17 using the Lit/Web Component backoffice.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Umbraco.Cms.Web.Common (>= 17.0.0 && < 18.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.