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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lucide-1.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 bb5697226877ba35ac77472a416a728bffe4bdb50044183ed6022ef067c234e7
MD5 94f89f42f66b7cd91dc3e1bfb6bd7d6e
BLAKE2b-256 2c29e826a18a7f594d0b57662d128cb62bfe50fd858f0d392d075d146ff8f271

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: django_lucide-1.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf6c666590a297724fd82bcc520fb0c7da3a0a8ffb9c1543aaf1597fce9d0c3
MD5 ead3a78365b3514ab5691dec146c376e
BLAKE2b-256 792fd9c78974f96076e0908900f77c35ad634448f98709aec8a6e665625c47cc

See more details on using hashes here.

Provenance

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