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.0.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.0-py3-none-any.whl (425.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lucide-1.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 35781fd621bbed9342d4feb8f00a3b2e0a52dbd1a257ecc410936848787cba36
MD5 45d2a09ab1445026970ecec57dd46d5d
BLAKE2b-256 50501aaab5b59192d10fca52e7e6664a52236c3157eea3e3994fcb344a0440b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lucide-1.3.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: django_lucide-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 425.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b9608a140b66c3713b94746a9306808bd68c8682acf413444b041ba6518c598
MD5 9d4db911b3f3004880bd38a320575688
BLAKE2b-256 b054320f7ddf3ed06fd0995acc966a54043d50c8ef685f76b7853778c48ea6ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lucide-1.3.0-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