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:

    {% load 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.2.0.tar.gz (424.8 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.2.0-py3-none-any.whl (425.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lucide-1.2.0.tar.gz
  • Upload date:
  • Size: 424.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 87b9707ac1aa83a6a95ecef53ffb832f87b69ae83639aaab1b2229ff43c714b9
MD5 53bdb215130577769a0b5b7c5dc9bdf9
BLAKE2b-256 5d3c02c94b51b18fe09e3f8882333a924579c3a4194cecc5cf3e16ea2dda7bab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: django_lucide-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 425.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 514e4436f2dba2fdd6ddddfbccc7e80d5966ed376ca9c34be92344cbe5769d8e
MD5 caf142901238e207c87352b4b9dff9e0
BLAKE2b-256 e6a5b028bfaee2398bb5dc834a1bf1d4ec9da7ceb37710eb3e4dbdfe10e76c87

See more details on using hashes here.

Provenance

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