DEV Community

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

Posted on • Originally published at deanmontgomery.com

2 1

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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay