Icon type SiteSetting

I am trying to add a SiteSetting to my plugin that can control the icons displayed for some components. The component itself was already going to be user customizable, so I wanted to add the SiteSetting as a way for staff to define the default icon. I know there is emoji_list type for SiteSettings, but there doesn’t seem to be one for SVG icons?

From what I can see, most plugins/TC use either image upload or plain string for icon settings. Am I missing a type/validator I can use? It feels weird to tell people to look up the styleguide and type the name of the icon.

3 Likes

I think it’s a case where we don’t have any icon based site settings, so we haven’t added a type for it. We have an icon picker component that’s made its way into other parts of the app, but nothing currently in site settings.

1 Like

That makes sense. I can’t really imagine any specific scenario where core would require it, as probably only Themes/TCs and plugins would have a use for an extremely UI focused setting.

I am using the icon picker component in other places more easily accessible for ordinary users, but the specific use case I have in mind would be for stuff like setting a default icon. Combined with the object SiteSetting type, it would make templating certain features easier for admins.

Would the team be open to adding an icon_type type to SiteSettings in core, even without any core site settings using it? I don’t mind reopening this topic as a Feature request if need be.

1 Like

Any update on this? I noticed that reactions will be added to core, and that plugin currently has the Discourse reactions like icon setting where you need to enter the icon name manually.

3 Likes

No plans at the moment, but maybe that’s a good opportunity for it. I’ll pass the idea along.

2 Likes

yea it would be great to be able to use this in component settings, especially object type settings - can this be added please?

similar request also mentioned here:

3 Likes

There is now an icon type site setting.

7 Likes

This is great! I’m assuming it can be used for TCs as well? Time to start updating some with this!

I am not sure that’s the case. There is no icon type here

I think you cannot use the emoji setting type from site settings like Emoji deny list in themes either

i don’t think it is yet (at least i couldn’t get it to work).

are there any plans for supporting type: icon inside object schemas for theme components, like this?

    links:
        type: objects
        schema:
          name: menu_link
          identifier: text
          properties:
            icon:
              type: icon
              required: true
            text:
              type: string
              required: true
              validations:
                min_length: 1
                max_length: 100
            url:
              type: string
              required: true
              validations:
                min_length: 1
                max_length: 500
...
5 Likes