Skip to content

Attach metadata to icons #9122

@callumbwhyte

Description

@callumbwhyte

Following a demo of the new <umb-icon> directive by @MMasey (looks awesome!) a discussion started about how we can make the experience of working with icons nicer.

It was discussed that it would be great to attach additional metadata around icons. This could be used to displaying a label alongside the icon, or improving search within the icon picker.

I think it would be cool to define icons as JSON, rather than files. This way we could store additional metadata.

[
    {
        "alias": "cat",
        "path": "umbraco/icons/cat.svg",
        "group": "animals"
    }
]

The alias field is the current name (minus -icon). The path is where the image is located (this could be relative to the /umbraco folder or absolute for packages, as is the case elsewhere in the CMS).

The group field is a proposal for a better way of grouping icons, perhaps to improve the currently overwhelming icon picker with a grouped experience much like the data type picker.

The Umbraco would have a big JSON file defining icons in this way. Following along the lines of #8884 the package.manifest file could also offer a way to define / override custom icons in the same way for package developers.

It's important that any labels or user-facing text can be localised - currently the icon picker search is based on icon CSS class / file names, which are in English and don't accurately represent the icon or are misspelled. The JSON structure doesn't lend itself too well to localisation, but the existing XML dictionary files could handle this by convention:

<area alias="icons">
    <key alias="cat">Cat</key>
</area>

This is just a dump of ideas in the hope we can agree on an approach and split this into some digestible chunks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions