DEV Community

Cover image for Use iconic.app icons in your Django templates
monty5811
monty5811

Posted on • Originally published at deanmontgomery.com

Use iconic.app icons in your Django templates

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" %}
Enter fullscreen mode Exit fullscreen mode

Easy peasy.

Links

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]
Enter fullscreen mode Exit fullscreen mode

Add it to your INSTALLED_APPS:

# settings.py
INSTALLED_APPS = [
    ...,
    'iconic',
    ...,
]
Enter fullscreen mode Exit fullscreen mode

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" %}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)