You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/macros.rst
+7-4
Original file line number
Diff line number
Diff line change
@@ -607,7 +607,9 @@ By default, it will enable the CSRF token check for all the POST requests, read
607
607
render_icon()
608
608
-------------
609
609
610
-
Render a Bootstrap icon.
610
+
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.
611
+
Note that serving the SVG sprite across a domain has an `issue with Chrome <https://issues.chromium.org/issues/41164645>`_.
612
+
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.
:param name: The name of icon, you can find all available names at `Bootstrap Icon <https://icons.getbootstrap.com/>`_.
627
629
:param size: The size of icon, you can pass any vaild size value (e.g. ``32``/``'32px'``, ``1.5em``, etc.), default to
628
630
use configuration ``BOOTSTRAP_ICON_SIZE`` (default value is `'1em'`).
629
631
:param color: The color of icon, follow the context with ``currentColor`` if not set. Accept values are Bootstrap style name
630
632
(one of ``['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', 'muted']``) or any valid color
631
633
string (e.g. ``'red'``, ``'#ddd'`` or ``'(250, 250, 250)'``), default to use configuration ``BOOTSTRAP_ICON_COLOR`` (default value is ``None``).
632
-
:param title: The title of the icon for accessibility support.
633
-
:param desc: The description of the icon for accessibility support.
634
+
:param title: The title of the icon for accessibility support. This is not supported for ``font=True``.
635
+
:param desc: The description of the icon for accessibility support. This is not supported for ``font=True``.
634
636
:param classes: The classes to use for styling (e.g. ``'text-success bg-body-secondary p-2 rounded-3'``).
637
+
: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``).
<iclass="bi-{{ name }}{% if color in bootstrap_colors %} text-{{ color }}{% endif %}" style="{% if color and color not in bootstrap_colors %}color: {{ color }}; {% endif %}font-size: {{ size }};"></i>
17
+
{%- else -%}
15
18
<svgclass="bi{% if not color %}{% if classes %} {{ classes }}{% endif %}"
16
19
{%-elifcolorinbootstrap_colors%}text-{{color}}"{% else %}" style="color: {{ color }}"{%endif-%}
0 commit comments