Skip to main content

Use tabler icons with django templates

Project description

If you are upgrading from 0.4.0, note that the default download location for icons has changed. Icons are now downloaded to the directory specified by the XDG_DATA_HOME environment variable, defaulting to <user_home_directory>/.local/share/django-tabler-icons/icons if not set. This change aligns with the XDG Base Directory Specification. If you have TABLER_ICONS_DIR set in your Django settings, it will take precedence. The previous default location was <user_home_directory>/.config/django-tabler-icons/icons, which you may want to remove if no longer needed.

Django tabler icons

Use the tabler icon set in your Django project.

Installation

Install the package from PyPI:

python -m pip install django-tabler-icons

Add tabler_icons to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'tabler_icons',
    ...
]

Download the icon set:

python manage.py download_icons

Icons will be downloaded to <user_home_directory>/.config/django-tabler-icons. You can override this by setting the TABLER_ICONS_DIR setting, in project settings. This command requires to load Django.

Alternative download method

Icons can also be downloaded without loading Django using:

django_tabler_icons download

which will download the icon set to <user_home_directory>/.config/django-tabler-icons. This requires user confirmation to proceed. By passing --yes or -y as an argument, the confirmation is skipped.

Usage

Tabler icons come in two different styles, "outline" and "filled". To add an icon to your template, use the tabler_icon_outline or tabler_icon_filled template tag, depending on the icon style you need. Note that only some of the tabler icons come in both styles.

{% load tabler_icons %}

{% tabler_icon_outline '<icon_name>' %}
{% tabler_icon_filled '<icon_name>' %}

In previous versions of this package, the tabler_icon was used. As of version 0.7.0, this tag has been replaced by tabler_icon_outline and tabler_icon_filled. For backwards compatibility, tabler_icon is still available as an alias for tabler_icon_outline. If you were using tabler_icon, no changes are required, but you are encouraged to update your templates to use tabker_icon_outline.

If you need to add classes to the icon, use the second argument:

{% tabler_icon_outline '<icon_name>' '<class_name_1> <class_name_2>' %}

The icons come with some default classes which you can remove by passing no to the third argument (keep_default_classes)

{% tabler_icon_outline '<icon_name>' '<class_name_1> <class_name_2>' 'no' %}

The default is to keep the default classes so you can omit the third argument if you want to keep them.

Relevant projects

Heroicons is a package for using heroicons in Django projects, which is also the inspiration for this package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_tabler_icons-0.7.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_tabler_icons-0.7.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file django_tabler_icons-0.7.2.tar.gz.

File metadata

  • Download URL: django_tabler_icons-0.7.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for django_tabler_icons-0.7.2.tar.gz
Algorithm Hash digest
SHA256 55c8cfde2f554811103f076cc9830bb5da76918f0c537bc22353e652008181a7
MD5 9ed0a7287f1969937dfb45a275a248f8
BLAKE2b-256 1780d13c15d6081a3a791cd5550465e98f27155fbd0eafbc6d75c573a834ef57

See more details on using hashes here.

File details

Details for the file django_tabler_icons-0.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_tabler_icons-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b057282dbaa13632ce80e76fea25bba0268cfe95f4673b9ec188f2a48f23951d
MD5 b3a18878b3a94b4c59f1269faa359089
BLAKE2b-256 2659f1a51b85a421c087614a73367f72600e31617716d7df5a8a417b7cb5774f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page