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
minor #2481 [Turbo] Document <twig:Turbo:Stream:*> (seb-jean, smnandre)
This PR was merged into the 2.x branch.
Discussion
----------
[Turbo] Document `<twig:Turbo:Stream:*>`
Hi,
I added docs for #2227.
I will document `<twig:Turbo:Stream>` in a second phase.
What do you think? Do you have any suggestions?
Close#2315
Commits
-------
f572ab5 Update src/Turbo/doc/index.rst
79a0180 Remove too many links
8441ec3 Document <twig:Turbo:Stream:*>
The element having the id "my_div_id" will be replaced by this block, without a full page reload!
394
394
395
-
<div>The task "{{ task }}" has been created!</div>
396
-
</template>
397
-
</turbo-stream>
395
+
<div>The task "{{ task }}" has been created!</div>
396
+
</template>
397
+
</turbo-stream>
398
398
{% endblock %}
399
399
400
400
Supported actions are ``append``, ``prepend``, ``replace``, ``update``,
401
401
``remove``, ``before``, ``after`` and ``refresh``.
402
402
`Read the Turbo Streams documentation for more details`_.
403
403
404
+
Stream Messages and Actions
405
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
406
+
407
+
To render a ``<turbo-stream>`` element, this bundle provides a set of ``<twig:Turbo:Stream:*>`` Twig Components. These components make it easy to inject content directly into the ``<template>`` tag, pass attributes, and set the desired morphing mode with a clear and consistent syntax.
408
+
409
+
Append
410
+
""""""
411
+
412
+
.. code-block:: html+twig
413
+
414
+
<twig:Turbo:Stream:Append target="#dom_id">
415
+
Content to append to container designated with the dom_id.
416
+
</twig:Turbo:Stream:Append>
417
+
418
+
{# renders as: #}
419
+
<turbo-stream action="append" targets="#dom_id">
420
+
<template>
421
+
Content to append to container designated with the dom_id.
422
+
</template>
423
+
</turbo-stream>
424
+
425
+
Prepend
426
+
"""""""
427
+
428
+
.. code-block:: html+twig
429
+
430
+
<twig:Turbo:Stream:Prepend target="#dom_id">
431
+
Content to prepend to container designated with the dom_id.
432
+
</twig:Turbo:Stream:Prepend>
433
+
434
+
{# renders as: #}
435
+
<turbo-stream action="prepend" targets="#dom_id">
436
+
<template>
437
+
Content to prepend to container designated with the dom_id.
438
+
</template>
439
+
</turbo-stream>
440
+
441
+
Replace
442
+
"""""""
443
+
444
+
.. code-block:: html+twig
445
+
446
+
<twig:Turbo:Stream:Replace target="#dom_id">
447
+
Content to replace the element designated with the dom_id.
448
+
</twig:Turbo:Stream:Replace>
449
+
450
+
{# renders as: #}
451
+
<turbo-stream action="replace" targets="#dom_id">
452
+
<template>
453
+
Content to replace the element designated with the dom_id.
0 commit comments