From 1fa250362f44c0f7115959a2a5fe399c272b0bbb Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Wed, 19 May 2021 20:46:02 +0200 Subject: [PATCH] doc: stimulus_action() and stimulus_target() Following #124 and https://github.com/symfony/webpack-encore-bundle/pull/124#issuecomment-844348600 --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index af677b0d..9703b522 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,9 @@ class ScriptNonceSubscriber implements EventSubscriberInterface } ``` -## Stimulus / Symfony UX Helper: stimulus_controller +## Stimulus / Symfony UX Helper + +### stimulus_controller This bundle also ships with a special `stimulus_controller()` Twig function that can be used to render [Stimulus Controllers & Values](https://stimulus.hotwire.dev/reference/values). @@ -238,4 +240,64 @@ associative array in the first argument: ``` +### stimulus_action + +The `stimulus_action()` Twig function can be used to render [Stimulus Actions](https://stimulus.hotwire.dev/reference/actions). + +For example: +```twig +
Hello
+
Hello
+ + +
Hello
+
Hello
+``` + +If you have multiple actions and/or methods on the same element, pass them all as an +associative array in the first argument: +```twig +
+ Hello +
+ + +
+ Hello +
+``` + +### stimulus_target + +The `stimulus_target()` Twig function can be used to render [Stimulus Targets](https://stimulus.hotwire.dev/reference/targets). + +For example: +```twig +
Hello
+
Hello
+ + +
Hello
+
Hello
+``` + +If you have multiple targets on the same element, pass them all as an +associative array in the first argument: +```twig +
+ Hello +
+ + +
+ Hello +
+``` + Ok, have fun!