File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2175,6 +2175,32 @@ To validate only on "change", use the ``on(change)`` modifier:
2175
2175
class="{{ _errors.has('post.content') ? 'is-invalid' : '' }}"
2176
2176
>
2177
2177
2178
+ Deferring the Loading
2179
+ ---------------------
2180
+
2181
+ Certain components might be heavy to load. You can defer the loading of these components
2182
+ until after the rest of the page has loaded. To do this, use the ``defer `` attribute:
2183
+
2184
+ .. code-block :: twig
2185
+
2186
+ {{ component('SomeHeavyComponent', { defer: true }) }}
2187
+
2188
+ Doing so will render an empty "placeholder" tag with the live attributes. Once the ``live:connect `` event is triggered,
2189
+ the component will be rendered asynchronously.
2190
+
2191
+ By default the rendered tag is a ``div ``. You can change this by specifying the ``loading-tag `` attribute:
2192
+
2193
+ .. code-block :: twig
2194
+
2195
+ {{ component('SomeHeavyComponent', { defer: true, loading-tag: 'span' }) }}
2196
+
2197
+ If you need to signify that the component is loading, use the ``loading-template `` attribute.
2198
+ This lets you provide a Twig template that will render inside the "placeholder" tag:
2199
+
2200
+ .. code-block :: twig
2201
+
2202
+ {{ component('SomeHeavyComponent', { defer: true, loading-template: 'spinning-wheel.html.twig' }) }}
2203
+
2178
2204
Polling
2179
2205
-------
2180
2206
You can’t perform that action at this time.
0 commit comments