diff --git a/src/TwigComponent/doc/index.rst b/src/TwigComponent/doc/index.rst index 2cd8c8137e9..30395484081 100644 --- a/src/TwigComponent/doc/index.rst +++ b/src/TwigComponent/doc/index.rst @@ -1046,6 +1046,79 @@ And in your component template you can access your embedded block {% block footer %}{% endblock %} +Anonymous TwigComponent +----------------------- + +Sometimes, reusable elements do not require complex logic or injected service to render what it could be processed +from one template itself. (e.g. retrieving a customized primary button that could take a different label). + +No need for class. Your component matches the namespace of the file you created where components live (see `Twig Template Namespaces`_). + +.. code-block:: html+twig + + {# templates/components/Button/Primary.html.twig #} + + +Then use your component with ``:`` to navigate through the directories: + +.. code-block:: html+twig + + {# index.html.twig #} + ... +