Use iconic.app icons in your Django templates

17 Aug 2021

iconic.app icons are a wonderful, free, set of icons. You can use them wherever you like. How you use them is by copy and pasting and SVG into your templates. That can be a bit cumbersome.

But there is a better way for your Django (and Jinja) templates: use iconic and you can include any icon by name:

{% load iconic %}

{% iconic_icon "announcement" size=48 class="h-4 w-4 inline" %}

Easy peasy.

Credits

Caveats

Right now this package does not support the Pro icons in any way - you still need to copy and paste those SVGs.

Full Instructions

Install the package

pip install iconic[django]

Add it to your INSTALLED_APPS:

# settings.py
INSTALLED_APPS = [
    ...,
    'iconic',
    ...,
]

Then just load it and use it in your templates:

{% load iconic %}

{% iconic_icon "announcement" size=48 class="h-4 w-4 inline" data_controller="announcement" %}