Skip to main content

Phosphor Icons as django-components

Project description

djc-phosphor-icons

Phosphor Icons as django-components.

Installation

pip install djc-phosphor-icons

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django_components",
    "djc_phosphor_icons",
]

Usage

{% component "Icon" name="house" / %}
{% component "Icon" name="house" variant="bold" / %}
{% component "Icon" name="house" style="stroke" size=24 color="#ff0000" / %}
Kwarg Type Default Description
name str Icon name, e.g. "house"
variant str "regular" bold, duotone, fill, light, regular, thin
style str "flat" flat or stroke
size int None Sets width and height in px
color str None Sets CSS color
mirrored bool False Flips the icon horizontally
attrs dict None Extra attributes passed to the <svg> element

Settings

Configure via PHOSPHOR_ICONS in your Django settings:

PHOSPHOR_ICONS = {
    "auto_register": True,        # Auto-register the component on startup (default: True)
    "component_name": "Icon",     # Template tag name (default: "Icon")
    "default_style": "flat",      # Default style (default: "flat")
    "default_variant": "regular", # Default variant (default: "regular")
    "cache": True,                # Cache rendered output per unique set of kwargs (default: True)
}

Development

uv sync
uv run pytest
uv run ruff check .
uv run ruff format .

To update the icon set to a specific Phosphor release (for local inspection only — the update-icons GitHub Action handles this automatically when committing):

uv run python scripts/download_icons.py v2.1.0

To generate a visual preview of all icons:

uv run python scripts/preview_icons.py

Known Icon Issues

The following icons are incomplete in the upstream Phosphor release and will fail to render in certain combinations:

  • book-user: missing from stroke/light, stroke/bold, stroke/fill, stroke/duotone

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

djc_phosphor_icons-0.0.1.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

djc_phosphor_icons-0.0.1-py3-none-any.whl (9.1 MB view details)

Uploaded Python 3

File details

Details for the file djc_phosphor_icons-0.0.1.tar.gz.

File metadata

  • Download URL: djc_phosphor_icons-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djc_phosphor_icons-0.0.1.tar.gz
Algorithm Hash digest
SHA256 04f9b62a914623154f6dad8c9dd0e1f63da5041fddc6283522ecabd55225aeea
MD5 b1f949597d54a38f2559ffb05f7681f1
BLAKE2b-256 409e933dd4543030ab271910616b7407200fe8417bcb84127deb606bfa102e2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for djc_phosphor_icons-0.0.1.tar.gz:

Publisher: publish.yml on joeyjurjens/djc-phosphor-icons

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

File details

Details for the file djc_phosphor_icons-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for djc_phosphor_icons-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5bdbbe47fede341a8d4ca97e98483aae13f9be1abaee8c655e72369826cdc1d
MD5 24e814d66cd14ba0c873d6b9b4704430
BLAKE2b-256 1393025edc0a9ca0e4d4a51990351e4f8492ae409169a6c6d2bda00b14ec14cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for djc_phosphor_icons-0.0.1-py3-none-any.whl:

Publisher: publish.yml on joeyjurjens/djc-phosphor-icons

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