Skip to main content

iconic

https://img.shields.io/github/workflow/status/monty5811/iconic/CI/main?style=for-the-badge https://img.shields.io/codecov/c/github/monty5811/iconic/main?style=for-the-badge https://img.shields.io/pypi/v/iconicicons.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

Use iconic.app icons in your Django and Jinja templates.

Requirements

Python 3.6 to 3.9 supported.

Django 2.2 to 3.2 supported.


This was forked from adamchainz/heroicons <https://github.com/adamchainz/heroicons>

Are your tests slow? Check out Adam’s book Speed Up Your Django Tests which covers loads of best practices so you can write faster, more accurate tests.


Usage

The iconic package supports both Django templates and Jinja2 templates. Follow the appropriate guide below.

Django templates

  1. Install with python -m pip install iconic[django].

  2. Add to your INSTALLED_APPS:

    INSTALLED_APPS = [
        ...,
        'iconic',
        ...,
    ]

Now in your templates you can load the template library with:

{% load iconic %}

This provides a tag to render <svg> icons: iconic_icon. The tags take these arguments:

  • name, positional: the name of the icon to use. You can see the icon names on the iconic.app grid.

  • size, keyword: an integer that will be used for the width and height attributes of the output <svg> tag. Defaults to the icons’ designed size: 24.

  • Any number of keyword arguments. These will be added as HTML attributes to the output <svg> tag. Underscores in attribute names will be replaced with dashes, allowing you to define e.g. data- attributes.

For example, to render an outline “announcement” icon, at 48x48, with some extra CSS classes and a data attribute “controller”, you would write:

{% iconic_icon "announcement" size=48 class="h-4 w-4 inline" data_controller="academia" %}

Jinja templates

  1. Install with python -m pip install iconic[jinja].

  2. Adjust your Jinja Environment to add the global function iconic, imported from iconic.jinja. For example:

    from iconic.jinja import iconic_icon
    from jinja2 import Environment
    
    env = Environment()
    env.globals.update(
        {
            "iconic_icon": iconic_icon,
        }
    )

Now in your templates you can call those two functions, which render <svg> icons corresponding to the two icon styles in the set. The functions take these arguments:

  • name, positional: the name of the icon to use. You can see the icon names on the iconic.app grid.

  • size, keyword: an integer that will be used for the width and height attributes of the output <svg> tag. Defaults to the icons’ designed size: 24.

  • Any number of keyword arguments. These will be added as HTML attributes to the output <svg> tag. Underscores in attribute names will be replaced with dashes, allowing you to define e.g. data- attributes.

For example, to render an outline “announcement” icon, at 48x48, with some extra CSS classes and a data attribute “controller”, you would write:

{% iconic("announcement", size=48, class="h-4 w-4 inline", data_controller="academia") %}

Metadata

Release files for iconic 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iconic 1.0.0
File Size Uploaded Provenance
iconic-1.0.0.tar.gz 69.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for iconic 1.0.0
File Interpreter ABI Platform
iconic-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 135.1 kB

Release files / iconic-1.0.0.tar.gz

Download URL iconic-1.0.0.tar.gz
Size 69.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8f43b33f191fcdc947d2adaef1cc91fe0c21a2da378621409da695112bfe9fb7
BLAKE2b-256 checksum
How to use checksums
ef645ab6fbe9dec5a467e0195907e96993605c460f15dd3723a1254784d1cebd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

Release files / iconic-1.0.0-py3-none-any.whl

Download URL iconic-1.0.0-py3-none-any.whl
Size 66.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
620c7f29ba689c7e93a5d5a48a608d2a9c054ecbe8c0693b52c086bfd248d2d7
BLAKE2b-256 checksum
How to use checksums
8a6abd235c3457e50d10d2498d49b2d27f74fdba76bc16e54b533e43e124263c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

Security for iconic 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page