You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{% load icons %}
<!-- Include your icon library. This example uses Font Awesome 6 through cdnjs. -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
{% icon 'edit' %}
This will generate the FontAwesome 6 pencil icon in regular style.
<iclass="fa-solid fa-pencil"></i>
Add extra classes and attributes to your predefined icon.
The test suite requires tox to be installed. Run the complete test suite like this:
tox
Test for the current environment can be run with the Django manage.py command.
just test
Origin
Our plans at Zostera for an icon tool originate in https://github.com/dyve/django-bootstrap3. We isolated this into a Font Awesome tool in https://github.com/zostera/django-fa. When using our own product, we felt that the icon tool provided little improvement over plain HTML. Also, Font Awesome's icon names did not match the intended function of the icon.
This is how we came to think of a library that:
Took a limited number of arguments
Converted those arguments into an icon
Was able to support multiple icon libraries
Could bind an icon definition to a preset name for easy reuse
Could easily be extended by users
This is how we came to write and use django-icons.