How Do I add custom icon such as those from HealthIcons to DHIS2

I am interested in the possibility of adding my own custom icons. Where can I add the custom icons? Is it in dhis2-core repo or a particular app?

There is a C:\xxx\dhis2-core\dhis-2\dhis-web\dhis-web-commons-resources\src\main\webapp\icons directory in dhis2-core. Can I add it there?

Also when I looked at the properties of DataElement schema through the API https://play.dhis2.org/40.3.0/api/schemas/dataElement.json, I didn’t see icon or image but in the Maintenance App, one of the fields is Add Icon and it is preloaded with some icons that I can select from. Where is this icons imported from and how can I add mine to it?

Hi @jetisco4u

From my understanding your question is specifically about icons that add visual context to the metadata. From the documentation, it appears that the icons are accessed through dhis2-domain/api/icons/

I think the best way to go is request using (DHIS2 Android App - DHIS2 Documentation) and filling out the form so it will be available for future versions as well when you update, and it will be available on both web and anrdiod.

Checking further each icon in the response has the following structure:

"key": "for_example_name",
"description": "some description",
"keywords": [
"keyword1",
"keyword2"
],
"href": "domain-instance/api/icons/for_example_name/icon.svg"

It looks like you’ve already found a way… and I think the idea might be to add to the file itself and ensuring the same format.

Additionally, I found this repository, if you have some time to test this option and see if it works: GitHub - dhis2/dhis2-icons: DHIS 2 Icons

Hope this helps!

1 Like

Thanks @Gassim this repo approach work for me. Although I didn’t follow the approach in the documentation. I just add the SVG and update the Icon.java file. I checked and can see all the icons I added in the Maintenance App.

1 Like

Happy to report that this will also be natively supported in v41 :slight_smile:

https://dhis2.atlassian.net/browse/DHIS2-14272

3 Likes