File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,21 @@ define the HTML attributes added to the ``<svg>`` element:
8383 {{ ux_icon('user-profile', {height: '16px', width: '16px', 'aria-hidden': true}) }}
8484 {# renders <svg height="16" width="16" aria-hidden="true"> ... </svg> #}
8585
86+ .. note ::
87+
88+ Without size instructions, ``<svg> `` elements will be dynamically sized by the browser.
89+ For icons, we therefore recommend to explicitly set the size. This can be done with a
90+ CSS class or a height attribute in pixels, with variables of your CSS framework or using
91+ ``em `` to set the size in relation to the font size of the current element.
92+
93+ Note that it is enough to specify the height, the width will be adjusted accordingly:
94+
95+ .. code-block :: twig
96+
97+ {{ ux_icon('user-profile', {style: 'height: 1em;'}) }}
98+
99+ For a consistent look, you might want to set the size through a
100+ :ref: `default attribute <icons_default_attributes >`.
86101
87102Icon Sets
88103~~~~~~~~~
@@ -313,6 +328,8 @@ HTML Syntax
313328
314329 ``symfony/ux-twig-component `` is required to use the HTML syntax.
315330
331+ .. _icons_default_attributes :
332+
316333Default Attributes
317334~~~~~~~~~~~~~~~~~~
318335
You can’t perform that action at this time.
0 commit comments