Skip to main content

Bootstrap Icons renderer for django-icons

Project description

django-icons-bootstrap-icons

This project provides a renderer for Bootstrap Icons utilizing django-icons.

Installation

PyPI

Just run:

pip install django-icons-bootstrap-icons

To use

In your settings.py file:

DJANGO_ICONS = {
  "DEFAULT": {
    "renderer": "django_icons_bootstrap_icons.BootstrapIconRenderer"
  }
}

Then just use the {% icon %} tag as normal!

Extra features

This renderer includes a very neat feature over the default IconRenderer, which is support for custom attributes.

For instance, to add an aria-label to your icon, you can do the following:

{% icon "person" aria_label="person icon" %}

Note that while attributes in HTML are -, separated, this isn't possible in Django templates due to Python. Therefore, write the keys with _ instead, and the renderer will autoconvert them for you.

This also works with attributes that do not have -es in them, such as tabindex.

Aside from this, BootstrapIconRenderer supports all features of the default renderer as it is just a superclass of IconRenderer.

Contributing

I welcome all contributions! Just fork and then send a PR.

License

This work is licensed under the MIT license.

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_icons_bootstrap_icons-1.0.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

django_icons_bootstrap_icons-1.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file django_icons_bootstrap_icons-1.0.1.tar.gz.

File metadata

File hashes

Hashes for django_icons_bootstrap_icons-1.0.1.tar.gz
Algorithm Hash digest
SHA256 10db76b6756e7eac9ddd857f3af3c66f9779856e255cb2dc9d2871f3568a0c14
MD5 d2e0775dab7dbb2b7435ff6e989ecdb2
BLAKE2b-256 06b959373d8d6b35f3b44f54fd10bc7b140d14db58da66f1f30944829acff500

See more details on using hashes here.

File details

Details for the file django_icons_bootstrap_icons-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_icons_bootstrap_icons-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7423689bc4c7c820dc2f85e7c9c0a5528feedcf636620eeb5eb9a801f4af8287
MD5 fa74c2ce123d5457d15445360f82d988
BLAKE2b-256 06afeb41273b1e9abd431113aedfddefdbbbf9945fa9a13ed07a368618c94c22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page