AndrewK.Umbraco.Dictionary 1.1.0

dotnet add package AndrewK.Umbraco.Dictionary --version 1.1.0
                    
NuGet\Install-Package AndrewK.Umbraco.Dictionary -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AndrewK.Umbraco.Dictionary" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AndrewK.Umbraco.Dictionary" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AndrewK.Umbraco.Dictionary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AndrewK.Umbraco.Dictionary --version 1.1.0
                    
#r "nuget: AndrewK.Umbraco.Dictionary, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AndrewK.Umbraco.Dictionary@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AndrewK.Umbraco.Dictionary&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AndrewK.Umbraco.Dictionary&version=1.1.0
                    
Install as a Cake Tool

AndrewK.Umbraco.Dictionary

AndrewK.Umbraco.Dictionary is a custom property editor for Umbraco 16 that allows content editors to store and manage multiple key-value pairs in a structured way.
It provides an intuitive user interface for adding, editing, and removing dictionary-style data directly within the Umbraco backoffice.


Features

  • Key-Value Pair Management: Add, edit, and remove key-value pairs with an intuitive UI.
  • Configurable Limits: Set minimum and maximum number of entries through property editor configuration.
  • Drag & Drop Reordering: Reorder dictionary items using drag handles.
  • Validation Support: Built-in validation for required keys and proper form handling.
  • Type-Safe Access: Strong-typed property value converter returns ICollection<KeyValuePair<string, string>>.
  • Umbraco 16 Compatible: Built specifically for Umbraco 16 using modern Lit elements and TypeScript.

Installation

You can install the package via NuGet:

  dotnet add package AndrewK.Umbraco.Dictionary

Usage

Creating a Dictionary Property

  1. Create a new Data Type in the Umbraco backoffice
  2. Select "AndrewK Dictionary" as the property editor
  3. Configure minimum and maximum number of entries (optional)
  4. Add the data type to your document type

Configuration Options

  • Minimum: Enter the minimum number of key-value pairs to be displayed
  • Maximum: Enter the maximum number of key-value pairs to be displayed (enter 0 for unlimited)

Accessing Dictionary Data in Controllers/Services/Templates

public class MyController : Controller
{
    public IActionResult Index()
    {
        var content = // ... get your content
        var dictionary = content.Value<ICollection<KeyValuePair<string, string>>>("myDictionaryProperty");
        
        foreach (var kvp in dictionary ?? [])
        {
            var key = kvp.Key;
            var value = kvp.Value;
            // Process your key-value pairs
        }
        
        return View();
    }
}

Example Of Setting Dictionary Data in Controllers/Services

public class MyController : Controller
{
    public IActionResult Index()
    {
        var collectionOfKeyValuePairs = // ... your collection, serializable to a list of key-value pairs
        
        // needed to serialize property names (e.g., 'key' or 'value') in a way the converter can deserialize them
        var settings = new JsonSerializerSettings
        {
            ContractResolver = new CamelCasePropertyNamesContractResolver()
        };
        
        // set serialized object
        content.SetValue(PropertyAlias, JsonConvert.SerializeObject(collectionOfKeyValuePairs, settings));
        
        return View();
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on AndrewK.Umbraco.Dictionary:

Package Downloads
AndrewK.Umbraco.Dropdown

Makes it possible to work with label on UI and values on the server side

AndrewK.Umbraco.RadioButtonList

Makes it possible to work with label on UI and values on the server side

AndrewK.Umbraco.CheckBoxList

Makes it possible to work with label on UI and values on the server side

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 34 7/18/2025
1.0.0 340 6/12/2025
0.9.0 150 6/5/2025

Version 1.1.0:
           - Improved FE value migration from `string` or `array` type properties
           - native and custom validation improvements