A quick way to add Bootstrap Icons with Django template tags.
Project description
django-bootstrap-icons
A quick way to add Bootstrap Icons with Django template tags.
This package contains Bootstrap Icons v1.2.2 (Jan 2021).
The icons are embedded from the icon font. If you'd rather like to use the svg images try this one: django_bs_icons.
Installing
django-bootstrap-icons
can be found on pypi. Run pip install django-bootstrap-icons
to install the package on your machine.
Getting Started
Using django-bootstrap-icons is easy. First, install the django_material_icons
Django app in your settings file.
INSTALLED_APPS = [
'django_bootstrap_icons'
]
Also, include the following tags in your base template file. It includes the CDN link to the bootstrap icons web font. If you have your own source for the web font, feel free to opt out of this tag!
{% load django_bootstrap_icons %}
{% include_bootstrap_icons %}
Then, add an icon with the following tag. Give the name icon's name as the first parameter, and that's all that's required.
{% load django_bootstrap_icons %}
{% bs_icon 'alarm' %}
Icon styling
To style the icons, you can add extra css classes:
{% bs_icon 'alarm' extra_classes='your-class-name' %}
Sizing classes are included in the bootstrap icon css:
{% bs_icon 'alarm' extra_classes='bi-xs' %}
{% bs_icon 'alarm' extra_classes='bi-sm' %}
{% bs_icon 'alarm' extra_classes='bi-2x' %}
{% bs_icon 'alarm' extra_classes='bi-3x' %}
{% bs_icon 'alarm' extra_classes='bi-5x' %}
{% bs_icon 'alarm' extra_classes='bi-7x' %}
{% bs_icon 'alarm' extra_classes='bi-10x' %}
If you have bootstrap css included, you can use the bootstrap color classes:
{% bs_icon 'alarm' extra_classes='text-success' %}
{% bs_icon 'alarm' extra_classes='text-info' %}
{% bs_icon 'alarm' extra_classes='text-warning' %}
{% bs_icon 'alarm' extra_classes='text-danger' %}
{% bs_icon 'alarm' extra_classes='text-primary' %}
{% bs_icon 'alarm' extra_classes='text-secondary' %}
License
This project is licensed under the MIT License - see the LICENSE file for details
Acknowledgments
- Thanks bootstrap Icons!
- Thanks to Doug Dresser dwdresser for the django_material_icon app that i used as a template
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-bootstrap-icons-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b6bd3d883ca181f8a309ad752ea3c98c0c8ff43ea0babd80f5bc6d818baecd |
|
MD5 | 17e74fe98a333a7a27c39dd71dd30e6f |
|
BLAKE2b-256 | 26f9e58e4c2c529f55355049c39bbd89ec658ea0e33d33ff9fe23fe11f4e1ab8 |
Hashes for django_bootstrap_icons-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af7bb97754bfa78e5558a7b7a84eb838a750b1d3225bc34e24f314a752eda152 |
|
MD5 | b226be6e1284e4806512ccb94066bc65 |
|
BLAKE2b-256 | 82cad89e091d87a81107c185da93c56bfeb71077421ccedc438fd6ff85fbd213 |