File tree 1 file changed +17
-0
lines changed
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:
83
83
{{ ux_icon('user-profile', {height: '16px', width: '16px', 'aria-hidden': true}) }}
84
84
{# renders <svg height="16" width="16" aria-hidden="true"> ... </svg> #}
85
85
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 >`.
86
101
87
102
Icon Sets
88
103
~~~~~~~~~
@@ -313,6 +328,8 @@ HTML Syntax
313
328
314
329
``symfony/ux-twig-component `` is required to use the HTML syntax.
315
330
331
+ .. _icons_default_attributes :
332
+
316
333
Default Attributes
317
334
~~~~~~~~~~~~~~~~~~
318
335
You can’t perform that action at this time.
0 commit comments