1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637
|
Use Macros
==========
These macros will help you to generate Bootstrap-markup codes quickly and easily.
render_nav_item()
------------------
Render a Bootstrap nav item.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/nav.html' import render_nav_item %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="navbar-nav mr-auto">
{{ render_nav_item('index', 'Home') }}
{{ render_nav_item('explore', 'Explore') }}
{{ render_nav_item('about', 'About') }}
</div>
</nav>
API
~~~~
.. py:function:: render_nav_item(endpoint, text, _badge='', _use_li=False, _badge_classes='...', **kwargs)
:param endpoint: The endpoint used to generate URL.
:param text: The text that will displayed on the item.
:param _badge: Badge text.
:param _badge_classes: Badge classes. For Bootstrap 4, the default value is ``badge badge-light``.
For Bootstrap 5, the default value is ``badge text-bg-light``.
:param _use_li: Default to generate ``<a></a>``, if set to ``True``, it will generate ``<li><a></a></li>``.
:param kwargs: Additional keyword arguments pass to ``url_for()``.
render_breadcrumb_item()
--------------------------
Render a Bootstrap breadcrumb item.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/nav.html' import render_breadcrumb_item %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{{ render_breadcrumb_item('home', 'Home') }}
{{ render_breadcrumb_item('users', 'Users') }}
{{ render_breadcrumb_item('posts', 'Posts') }}
{{ render_breadcrumb_item('comments', 'Comments') }}
</ol>
</nav>
API
~~~~
.. py:function:: render_breadcrumb_item(endpoint, text, **kwargs)
:param endpoint: The endpoint used to generate URL.
:param text: The text that will displayed on the item.
:param kwargs: Additional keyword arguments pass to ``url_for()``.
render_field()
----------------
Render a form input for form field created by
`Flask-WTF/WTForms <https://wtforms.readthedocs.io/en/master/fields/>`_.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/form.html' import render_field %}
<form method="post">
{{ form.csrf_token() }}
{{ render_field(form.username) }}
{{ render_field(form.password) }}
{{ render_field(form.submit) }}
</form>
You can pass any HTTP attributes as extra keyword arguments like ``class`` or ``placeholder``:
Notice that a ``placeholder`` is only allowed by `W3C validation <https://validator.w3.org/>`_
when the input type is ``email``, ``number``, ``password``, ``search``, ``tel``,
``text`` or ``url``. However, it is possible to use a placeholder for input types
such as ``datetime``.
.. code-block:: jinja
{% from 'bootstrap4/form.html' import render_field %}
<form method="post">
{{ form.csrf_token() }}
{{ render_field(form.username, class='myClass') }}
{{ render_field(form.password, placeholder='Your Password') }}
{{ render_field(form.submit) }}
</form>
Notice the ``class`` value here will overwrite the ``render_kw={'class': '...'}`` you defined in
the form class. Bootstrap-Flask will combine the class value you passed with the ``class`` key of
the ``render_kw`` dict or the ``class`` keyword arguments with Bootstrap classes.
API
~~~~
.. py:function:: render_field(field,\
form_type='basic',\
horizontal_columns=('lg', 2, 10),\
button_style='',\
button_size='',\
button_map={},\
form_group_classes='')
:param field: The form field (attribute) to render.
:param form_type: One of ``basic``, ``inline`` or ``horizontal``. See the
Bootstrap docs for details on different form layouts.
:param horizontal_columns: When using the horizontal layout, layout forms
like this. Must be a 3-tuple of ``(column-type,
left-column-size, right-column-size)``.
:param button_style: Set button style for ``SubmitField``. Accept Bootstrap button style name (i.e. primary,
secondary, outline-success, etc.), default to ``primary`` (e.g. ``btn-primary``). This will
overwrite config ``BOOTSTRAP_BTN_STYLE``.
:param button_size: Set button size for ``SubmitField``. Accept Bootstrap button size name: sm, md, lg, block,
default to ``md``. This will overwrite config ``BOOTSTRAP_BTN_SIZE``.
:param form_group_classes: Bootstrap 5 only (``bootstrap5/form.html``). You can use this parameter to change the
form group classes, it will read the config ``BOOTSTRAP_FORM_GROUP_CLASSES`` first
(the default value is ``mb-3``).
.. tip:: See :ref:`button_customization` and :ref:`checkbox_customization` to learn more on customizations.
render_form()
---------------
Render a complete form element for form object created by Flask-WTF/WTForms.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/form.html' import render_form %}
{{ render_form(form) }}
API
~~~~
.. py:function:: render_form(form,\
action='',\
method='post',\
extra_classes=None,\
role='form',\
form_type='basic',\
horizontal_columns=('lg', 2, 10),\
enctype=None,\
button_style='',\
button_size='',\
button_map={},\
id='',\
novalidate=False,\
render_kw={},\
form_group_classes='',\
form_inline_classes='',)
:param form: The form to output.
:param action: The URL to receive form data.
:param method: ``<form>`` method attribute.
:param extra_classes: The classes to add to the ``<form>``.
:param role: ``<form>`` role attribute.
:param form_type: One of ``basic``, ``inline`` or ``horizontal``. See the
Bootstrap docs for details on different form layouts.
:param horizontal_columns: When using the horizontal layout, layout forms
like this. Must be a 3-tuple of ``(column-type,
left-column-size, right-column-size)``.
:param enctype: ``<form>`` enctype attribute. If ``None``, will
automatically be set to ``multipart/form-data`` if a
:class:`~wtforms.fields.FileField` or :class:`~wtforms.fields.MultipleFileField` is present in the form.
:param button_style: Set button style for ``SubmitField``. Accept Bootstrap button style name (i.e. primary,
secondary, outline-success, etc.), default to ``primary`` (e.g. ``btn-primary``). This will
overwrite config ``BOOTSTRAP_BTN_STYLE``.
:param button_size: Set button size for ``SubmitField``. Accept Bootstrap button size name: sm, md, lg, block,
default to ``md``. This will overwrite config ``BOOTSTRAP_BTN_SIZE``.
:param button_map: A dictionary, mapping button field name to Bootstrap button style names. For example,
``{'submit': 'success'}``. This will overwrite ``button_style`` and ``BOOTSTRAP_BTN_STYLE``.
:param id: The ``<form>`` id attribute.
:param novalidate: Flag that decide whether add ``novalidate`` class in ``<form>``.
:param render_kw: A dictionary, specifying custom attributes for the
``<form>`` tag.
:param form_group_classes: Bootstrap 5 only (``bootstrap5/form.html``). You can use this parameter to change the form group classes, it will
read the config ``BOOTSTRAP_FORM_GROUP_CLASSES`` first (the default value is ``mb-3``).
:param form_inline_classes: Bootstrap 5 only (``bootstrap5/form.html``). You can use this parameter to change the form inline classes,
it will read the config ``BOOTSTRAP_FORM_INLINE_CLASSES`` first (the default value is
``row row-cols-lg-auto g-3 align-items-center``).
.. tip:: See :ref:`button_customization` to learn how to customize form buttons.
render_hidden_errors()
----------------------
Render error messages for hidden form field (``wtforms.HiddenField``).
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/form.html' import render_field, render_hidden_errors %}
<form method="post">
{{ form.hidden_tag() }}
{{ render_hidden_errors(form) }}
{{ render_field(form.username) }}
{{ render_field(form.password) }}
{{ render_field(form.submit) }}
</form>
API
~~~~
.. py:function:: render_hidden_errors(form)
:param form: Form whose errors should be rendered.
render_form_row()
------------------
Render a row of a grid form with the given fields.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/form.html' import render_form_row %}
<form method="post">
{{ form.csrf_token() }}
{{ render_form_row([form.username, form.password]) }}
{{ render_form_row([form.remember]) }}
{{ render_form_row([form.submit]) }}
{# Custom col which should use class col-md-2, and the others the defaults: #}
{{ render_form_row([form.title, form.first_name, form.surname], col_map={'title': 'col-md-2'}) }}
{# Custom col which should use class col-md-2 and modified col class for the default of the other fields: #}
{{ render_form_row([form.title, form.first_name, form.surname], col_class_default='col-md-5', col_map={'title': 'col-md-2'}) }}
</form>
API
~~~~
.. py:function:: render_form_row(fields,\
row_class='row/form-row',\
col_class_default='col',\
col_map={},\
button_style='',\
button_size='',\
button_map={},\
form_group_classes='',\
form_type='basic',\
horizontal_columns=('lg', 2, 10))
:param fields: An iterable of fields to render in a row.
:param row_class: Class to apply to the div intended to represent the row, like ``form-row`` (Bootstrap 4)
or ``row`` (Bootstrap 5).
:param col_class_default: The default class to apply to the div that represents a column
if nothing more specific is said for the div column of the rendered field.
:param col_map: A dictionary, mapping field.name to a class definition that should be applied to
the div column that contains the field. For example: ``col_map={'username': 'col-md-2'})``.
:param button_style: Set button style for ``SubmitField``. Accept Bootstrap button style name (i.e. primary,
secondary, outline-success, etc.), default to ``primary`` (e.g. ``btn-primary``). This will
overwrite config ``BOOTSTRAP_BTN_STYLE``.
:param button_size: Set button size for ``SubmitField``. Accept Bootstrap button size name: sm, md, lg, block,
default to ``md``. This will overwrite config ``BOOTSTRAP_BTN_SIZE``.
:param button_map: A dictionary, mapping button field name to Bootstrap button style names. For example,
``{'submit': 'success'}``. This will overwrite ``button_style`` and ``BOOTSTRAP_BTN_STYLE``.
:param form_group_classes: Bootstrap 5 only (``bootstrap5/form.html``). You can use this parameter to change the
form group classes, it will read the config ``BOOTSTRAP_FORM_GROUP_CLASSES`` first
(the default value is ``mb-3``).
:param form_type: One of ``basic``, ``inline`` or ``horizontal``. See the Bootstrap docs for details on different
form layouts.
:param horizontal_columns: When using the horizontal layout, layout forms like this. Must be a 3-tuple of
``(column-type, left-column-size, right-column-size)``.
.. tip:: See :ref:`button_customization` to learn how to customize form buttons.
render_pager()
-----------------
Render a simple pager for query pagination object created by Flask-SQLAlchemy.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/pagination.html' import render_pager %}
{{ render_pager(pagination) }}
API
~~~~
.. py:function:: render_pager(pagination,\
fragment='',\
prev=('<span aria-hidden="true">←</span> Previous')|safe,\
next=('Next <span aria-hidden="true">→</span>')|safe,\
align='',\
**kwargs)
:param pagination: :class:`~flask_sqlalchemy.Pagination` instance.
:param fragment: Add URL fragment into link, such as ``#comment``.
:param prev: Symbol/text to use for the "previous page" button.
:param next: Symbol/text to use for the "next page" button.
:param align: Can be 'left', 'center' or 'right', default to 'left'.
:param kwargs: Additional arguments passed to ``url_for``.
render_pagination()
--------------------
Render a standard pagination for query pagination object created by Flask-SQLAlchemy.
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/pagination.html' import render_pagination %}
{{ render_pagination(pagination) }}
API
~~~~
.. py:function:: render_pagination(pagination,\
endpoint=None,\
prev='«',\
next='»',\
ellipses='…',\
size=None,\
args={},\
fragment='',\
align='',\
**kwargs)
:param pagination: :class:`~flask_sqlalchemy.Pagination` instance.
:param endpoint: Which endpoint to call when a page number is clicked.
:func:`~flask.url_for` will be called with the given
endpoint and a single parameter, ``page``. If ``None``,
uses the requests current endpoint.
:param prev: Symbol/text to use for the "previous page" button. If
``None``, the button will be hidden.
:param next: Symbol/text to use for the "next page" button. If
``None``, the button will be hidden.
:param ellipses: Symbol/text to use to indicate that pages have been
skipped. If ``None``, no indicator will be printed.
:param size: Can be 'sm' or 'lg' for smaller/larger pagination.
:param args: Additional arguments passed to :func:`~flask.url_for`. If
``endpoint`` is ``None``, uses :attr:`~flask.Request.args` and
:attr:`~flask.Request.view_args`.
:param fragment: Add URL fragment into link, such as ``#comment``.
:param align: The align of the pagination. Can be 'left', 'center' or 'right', default to 'left'.
:param kwargs: Extra attributes for the ``<ul>``-element.
render_static()
----------------
Render a resource reference code (i.e. ``<link>``, ``<script>``).
Example
~~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/utils.html' import render_static %}
{{ render_static('css', 'style.css') }}
API
~~~~
.. py:function:: render_static(type, filename_or_url, local=True)
:param type: Resources type, one of ``css``, ``js``, ``icon``.
:param filename_or_url: The path of the file (relative to the static folder),
or the full URL when ``local`` set to ``False``.
:param local: Load local resources or from the passed URL.
render_messages()
------------------
Render Bootstrap alerts for flash messages send by ``flask.flash()``.
Example
~~~~~~~~
Flash the message in your view function with ``flash(message, category)``:
.. code-block:: python
from flask import flash
@app.route('/test')
def test():
flash('a info message', 'info')
flash('a danger message', 'danger')
return your_template
Render the messages in your base template (normally below the navbar):
.. code-block:: jinja
{% from 'bootstrap4/utils.html' import render_messages %}
<nav>...</nav>
{{ render_messages() }}
<main>...</main>
API
~~~~
.. py:function:: render_messages(messages=None,\
container=False,\
transform={...},\
default_category=config.BOOTSTRAP_MSG_CATEGORY,\
dismissible=False,\
dismiss_animate=False)
:param messages: The messages to show. If not given, default to get from ``flask.get_flashed_messages(with_categories=True)``.
:param container: If true, will output a complete ``<div class="container">`` element, otherwise just the messages each wrapped in a ``<div>``.
:param transform: A dictionary of mappings for categories. Will be looked up case-insensitively. Default maps all Python loglevel names to Bootstrap CSS classes.
:param default_category: If a category does not has a mapping in transform, it is passed through unchanged. ``default_category`` will be used when ``category`` is empty.
:param dismissible: If true, will output a button to close an alert. For fully functioning dismissible alerts, you must use the alerts JavaScript plugin.
:param dismiss_animate: If true, will enable dismiss animate when click the dismiss button.
When you call ``flash('message', 'category')``, there are 8 category options available, mapping to Bootstrap's alerts type:
primary, secondary, success, danger, warning, info, light, dark.
If you want to use HTML in your message body, just wrapper your message string with ``markupsafe.Markup`` to tell Jinja it's safe:
.. code-block:: python
from flask import flash
from markupsafe import Markup
@app.route('/test')
def test():
flash(Markup('a info message with a link: <a href="/">Click me!</a>'), 'info')
return your_template
render_table()
--------------
Render a Bootstrap table with given data.
Example
~~~~~~~
.. code-block:: python
@app.route('/test')
def test():
data = Message.query.all()
return render_template('test.html', data=data)
.. code-block:: jinja
{% from 'bootstrap4/table.html' import render_table %}
{{ render_table(data) }}
API
~~~~
.. py:function:: render_table(data,\
titles=None,\
primary_key='id',\
primary_key_title='#',\
caption=None,\
table_classes=None,\
header_classes=None,\
body_classes=None,\
responsive=False,\
responsive_class='table-responsive',\
safe_columns=None,\
urlize_columns=None,\
show_actions=False,\
actions_title='Actions',\
model=None,\
custom_actions=None,\
view_url=None,\
edit_url=None,\
delete_url=None,\
new_url=None)
:param data: An iterable of data objects to render. Can be dicts or class objects.
:param titles: An iterable of tuples of the format (prop, label) e.g ``[('id', '#')]``, if not provided,
will automatically detect on provided data, currently only support SQLAlchemy object.
:param primary_key: Primary key identifier for a single row, default to ``id``.
:param primary_key_title: Primary key title for a single row, default to ``#``.
:param caption: A caption to attach to the table.
:param table_classes: A string of classes to apply to the table (e.g ``'table-small table-dark'``).
:param header_classes: A string of classes to apply to the table header (e.g ``'thead-dark'``).
:param body_classes: A string of classes to apply to the table body (e.g ``'table-group-divider'``).
:param responsive: Whether to enable/disable table responsiveness.
:param responsive_class: The responsive class to apply to the table. Default is ``'table-responsive'``.
:param safe_columns: Tuple with columns names to render HTML safe using ``|safe``.
Has priority over ``urlize_columns`` parameter. Default is ``None``.
:param urlize_columns: Tuple with column names to render with HTML link on each URL
using ``|urlize``. Is overruled by ``safe_columns`` parameter. Default is ``None``.
WARNING: Only use this for sanitized user data to prevent XSS attacks.
:param show_actions: Whether to display the actions column. Default is ``False``.
:param model: An optional model used to build custom_action, view, edit,
delete URLs. Set this if you need to pull the URL arguments from
a different SQLAlchemy class indexed with the same primary key.
:param actions_title: Title for the actions column header. Default is ``'Actions'``.
:param custom_actions: A list of tuples for creating custom action buttons, where each tuple contains
('Title Text displayed on hover', 'bootstrap icon name', 'URL tuple or fixed URL string')
(e.g. ``[('Run', 'play-fill', ('run_report', [('report_id', ':id')]))]``).
:param view_url: URL string or URL tuple in ``('endpoint', [('url_parameter_name', ':db_model_fieldname')])``
to use for the view action.
:param edit_url: URL string or URL tuple in ``('endpoint', [('url_parameter_name', ':db_model_fieldname')])``
to use for the edit action.
:param delete_url: URL string or URL tuple in ``('endpoint', [('url_parameter_name', ':db_model_fieldname')])``
to use for the delete action.
:param new_url: URL string to use for the create action (new in version 1.6.0).
To set the URLs for table actions, you will need to pass either a fixed URL string or
an URL tuple in the form of ``('endpoint', [('url_parameter_name', ':db_model_fieldname')])``:
- ``endpoint``: endpoint of the view, normally the name of the view function
- ``[('url_parameter_name', ':db_model_fieldname')]``: a list of two-element tuples, the tuple should contain the
URL parameter name and the corresponding field name in the database model (starts with a ``:`` mark to indicate
it's a variable, otherwise it will becomes a fixed value). ``db_model_fieldname`` may also contain dots to access
relationships and their fields (e.g. ``user.name``).
By default, Bootstrap-Flask will take the fields from the row data provided.
Alternatively, you may set the ``model``, in which case a record from that
model, indexed with the same primary key, will be used to get the actual
value when building the URL.
For example, for the view below:
.. code-block:: python
class Message(Model):
id = Column(primary_key=True)
@app.route('/messages/<int:message_id>')
def view_message(message_id):
pass
To pass the URL point to this view for ``view_url``, the value will be: ``view_url=('view_message', [('message_id', ':id')])``.
Here is the full example:
.. code-block:: python
@app.route('/test')
def test():
data = Message.query.all()
return render_template('test.html', data=data)
.. code-block:: jinja
{% from 'bootstrap4/table.html' import render_table %}
{{ render_table(data, view_url=('view_message', [('message_id', ':id')])) }}
The following arguments are expected to accept a URL tuple:
- ``custom_actions``
- ``view_url``
- ``edit_url``
- ``delete_url``
When setting the ``delete_url``, you will also need to enable the CSRFProtect extension provided by Flask-WTF, so that
the CSRF protection can be added to the delete button:
.. code-block:: text
$ pip install flask-wtf
.. code-block:: python
from flask_wtf import CSRFProtect
csrf = CSRFProtect(app)
By default, it will enable the CSRF token check for all the POST requests, read more about this extension in its
`documentation <https://flask-wtf.readthedocs.io/en/latest/csrf/>`_.
render_icon()
-------------
Render a Bootstrap icon. This is either an SVG with a ``use`` element which refers to a locally hosted SVG sprite with an fragment identifier.
Note that serving the SVG sprite across a domain has an `issue with Chrome <https://issues.chromium.org/issues/41164645>`_.
Or it is possible to have a font icon rendered. This does support``BOOTSTRAP_SERVE_LOCAL`` but requires ``bootstrap.load_icon_font_css()`` in the template header.
Example
~~~~~~~
.. code-block:: jinja
{% from 'bootstrap4/utils.html' import render_icon %}
{{ render_icon('heart') }}
API
~~~~
.. py:function:: render_icon(name, size=config.BOOTSTRAP_ICON_SIZE, color=config.BOOTSTRAP_ICON_COLOR, title=None, desc=None, classes=None, font=False)
:param name: The name of icon, you can find all available names at `Bootstrap Icon <https://icons.getbootstrap.com/>`_.
:param size: The size of icon, you can pass any vaild size value (e.g. ``32``/``'32px'``, ``1.5em``, etc.), default to
use configuration ``BOOTSTRAP_ICON_SIZE`` (default value is `'1em'`).
:param color: The color of icon, follow the context with ``currentColor`` if not set. Accept values are Bootstrap style name
(one of ``['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', 'muted']``) or any valid color
string (e.g. ``'red'``, ``'#ddd'`` or ``'(250, 250, 250)'``), default to use configuration ``BOOTSTRAP_ICON_COLOR`` (default value is ``None``).
:param title: The title of the icon for accessibility support. This is not supported for ``font=True``.
:param desc: The description of the icon for accessibility support. This is not supported for ``font=True``.
:param classes: The classes to use for styling (e.g. ``'text-success bg-body-secondary p-2 rounded-3'``).
:param font: Generate ``<svg></svg>`` if set to ``False`` and generate ``<i></i>`` to use the icon font if set to ``True``, default to use configuration ``BOOTSTRAP_ICON_USE_FONT`` (default value is ``False``).
|