Skip to content

Commit

Permalink
Fix documentation, bump version to 0.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Wiegand committed Apr 17, 2021
1 parent d4663a7 commit 0ee286b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,53 @@ Set the color of an icon by specifying the color parameter:
For further styling, you can add extra css classes:

```
{% custom_icon 'your-custom-svg-name' %}
{% bs_icon 'alarm' extra_classes="your-classname1 your-classname2" %}
```

#### Vertical alignment

By default all sgv bootstrap icons are vertical aligned to the middle. Sometimes this is
not appropriate, especially when rendering beside text. To align with text *django-bootstrap-icons*
provides some css classes to set the desired vertical alignment.

Include the css file into your template

```
<link rel="stylesheet" href="{% static 'bootstrap_icons/css/bootstrap_icons.css' %}">
```

and add the class to the *extra_classes* parameter

```
{% bs_icon 'alarm' extra_classes="bi-valign-bottom" %}
```

The following classes are available:

```
.bi-valign-default /* This is a compromise also provided by bootstrap
for the icon font. The value is vertical-align: -.125em;
(see https://github.com/twbs/icons/issues/601 for details) */
.bi-valign-middle /* this is the real default, so you may not need it */
.bi-valign-bottom
.bi-valign-text-top
.bi-valign-text-bottom
```

### Custom icons
There's a template tag for your custom icons. Store the custom icons in some
static directory. SET the BS_ICON_CUSTOM_PATH setting to point to that static directory.

```
{% bs_icon 'alarm' extra_classes='your-class-name' %}
{% custom_icon 'your-custom-svg-name' %}
```

The custom template accepts the same parameter as the bootstrap icon template.

In fact you could download the bootstrap icons from bootstrap, store them in
your static files and use them with the custom_icon template tag. This would
avoid the use of CDN completely.

## Configuration

You can specify the source from which the icons are loaded:
Expand Down Expand Up @@ -113,6 +146,9 @@ This project is licensed under the MIT License - see the
* django-bootstrap-icons 0.5.0 (April 2021): Refactor to use bootstrap svg icons from CDN
* django-bootstrap-icons 0.5.1 (April 2021): Fix incorrect template tag names in documentation
* django-bootstrap-icons 0.5.2 (April 2021): Handle error if custom icon svg does not exist
* django-bootstrap-icons 0.5.3 (April 2021): Add css to specify vertical alignment of sgv icons
* django-bootstrap-icons 0.5.4 (April 2021): Fix some documentation issues, no need to install
since it affects only documentation

## Migration

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='django-bootstrap-icons',
version='0.5.3',
version='0.5.4',
packages=setuptools.find_packages(),
include_package_data=True,
description='A quick way to add Bootstrap Icons with Django template tags.',
Expand Down

0 comments on commit 0ee286b

Please sign in to comment.