Skip to main content

Use lucide in your Django and Jinja templates.

Project description

lucide

Use Lucide icons in your Django and Jinja templates.

Fork of franciscobmacedo/lucide with additional features:

  • Dynamic template attribute rendering (use {{ variables }} in attributes)
  • Icon alias support with deprecation warnings (246 aliases)
  • Automatic icon updates via GitHub Actions

Requirements

Python 3.8 to 3.12 supported.

Django 3.2 to 5.0 supported.

Installation

pip install django-lucide

Usage

The lucide package supports both Django templates and Jinja templates.

Django templates

  1. Add to your INSTALLED_APPS:

    INSTALLED_APPS = [
        ...,
        "lucide",
        ...,
    ]
    
  2. Load the template library in your templates:

    {% load lucide %}
    

    Or make it available globally (no {% load %} needed):

    TEMPLATES = [
        {
            "BACKEND": "django.template.backends.django.DjangoTemplates",
            # ...
            "OPTIONS": {
                # ...
                "builtins": [
                    "lucide.templatetags.lucide",
                ],
            },
        }
    ]
    
  3. Use icons:

    {% lucide "arrow-down" %}
    {% lucide "arrow-down" size=40 class="mr-4" %}
    {% lucide "arrow-down" stroke_width=1 data_controller="icon" %}
    

Dynamic attributes

You can use template variables in attributes:

{% lucide "user" class="{{ css_class }}" data-id="{{ user.id }}" %}

Icon aliases

Old icon names automatically resolve to new names with a deprecation warning:

{% lucide "edit-2" %}  {# Works, but warns to use "pen" instead #}

Jinja templates

  1. Add the global function to your environment:

    from lucide.jinja import lucide
    from jinja2 import Environment
    
    env = Environment()
    env.globals.update({"lucide": lucide})
    
  2. Use icons:

    {{ lucide("arrow-down") }}
    {{ lucide("arrow-down", size=40, class="mr-4") }}
    

Icon reference

Browse all available icons at lucide.dev/icons.

Acknowledgements

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_lucide-1.3.1.tar.gz (424.9 kB view details)

Uploaded Source

Built Distribution

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

django_lucide-1.3.1-py3-none-any.whl (425.3 kB view details)

Uploaded Python 3

File details

Details for the file django_lucide-1.3.1.tar.gz.

File metadata

  • Download URL: django_lucide-1.3.1.tar.gz
  • Upload date:
  • Size: 424.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_lucide-1.3.1.tar.gz
Algorithm Hash digest
SHA256 202202f08108e0d134b4444cac21035ea11b059445f05109ce787db60b58005d
MD5 65fa600dec447ea725e093197f1c0261
BLAKE2b-256 09c8d45394504e52dfc0878067b4858214c96752db676219b7f8980a66bfcdf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lucide-1.3.1.tar.gz:

Publisher: main.yml on wilczynskiwm/lucide

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_lucide-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: django_lucide-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 425.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_lucide-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d4d548637cc15f61f0710619bd86b09b240a89fc6fa3421d422046ef8cc72df
MD5 892090c327a764763da657abda46d82a
BLAKE2b-256 88e2d0cb84ac735ee1d85759111547a919b8cdd295d8a5f74b25892a4392b798

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lucide-1.3.1-py3-none-any.whl:

Publisher: main.yml on wilczynskiwm/lucide

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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