|
1 | 1 | StimulusBundle: Symfony integration with Stimulus
|
2 | 2 | =================================================
|
3 | 3 |
|
| 4 | +.. tip:: |
| 5 | + |
| 6 | + Check out live demos of Symfony UX at https://ux.symfony.com! |
| 7 | + |
4 | 8 | This bundle adds integration between Symfony, `Stimulus`_ and the Symfony UX packages:
|
5 | 9 |
|
6 | 10 | A) Twig ``stimulus_`` functions & filters to add Stimulus controllers,
|
@@ -69,14 +73,39 @@ for all the goodies.
|
69 | 73 |
|
70 | 74 | .. _ux-packages:
|
71 | 75 |
|
72 |
| -3rd Party Stimulus Controllers from UX Packages |
73 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
74 |
| - |
75 |
| -Your app will also activate any 3rd party controllers (installed by UX bundles) |
76 |
| -mentioned in your ``assets/controllers.json`` file. |
| 76 | +The UX Packages |
| 77 | +~~~~~~~~~~~~~~~ |
77 | 78 |
|
78 |
| -For a list of all of the UX package and other Stimulus tools, see the |
79 |
| -`Symfony UX documentation`_. |
| 79 | +Symfony provides a set of UX packages that add extra Stimulus controllers to solve |
| 80 | +common problems. StimulusBundle activates any 3rd party Stimulus controllers |
| 81 | +that are mentioned in your ``assets/controllers.json`` file. This file is updated |
| 82 | +whenever you install a UX package. |
| 83 | + |
| 84 | +The official UX packages are: |
| 85 | + |
| 86 | +* `ux-autocomplete`_: Transform ``EntityType``, ``ChoiceType`` or *any* |
| 87 | + ``<select>`` element into an Ajax-powered autocomplete field |
| 88 | + (`see demo <https://ux.symfony.com/autocomplete>`_) |
| 89 | +* `ux-chartjs`_: Easy charts with `Chart.js`_ (`see demo <https://ux.symfony.com/chartjs>`_) |
| 90 | +* `ux-cropperjs`_: Form Type and tools for cropping images (`see demo <https://ux.symfony.com/cropperjs>`_) |
| 91 | +* `ux-dropzone`_: Form Type for stylized "drop zone" for file uploads |
| 92 | + (`see demo <https://ux.symfony.com/dropzone>`_) |
| 93 | +* `ux-lazy-image`_: Optimize Image Loading with BlurHash |
| 94 | + (`see demo <https://ux.symfony.com/lazy-image>`_) |
| 95 | +* `ux-live-component`_: Build Dynamic Interfaces with Zero JavaScript |
| 96 | + (`see demo <https://ux.symfony.com/live-component>`_) |
| 97 | +* `ux-notify`_: Send server-sent native notification with Mercure |
| 98 | + (`see demo <https://ux.symfony.com/notify>`_) |
| 99 | +* `ux-react`_: Render `React`_ component from Twig (`see demo <https://ux.symfony.com/react>`_) |
| 100 | +* `ux-svelte`_: Render `Svelte`_ component from Twig (`see demo <https://ux.symfony.com/svelte>`_) |
| 101 | +* `ux-swup`_: Integration with `Swup`_ (`see demo <https://ux.symfony.com/swup>`_) |
| 102 | +* `ux-translator`_: Use your Symfony translations in JavaScript `Swup`_ (`see demo <https://ux.symfony.com/translator>`_) |
| 103 | +* `ux-turbo`_: Integration with `Turbo Drive`_ for a single-page-app experience |
| 104 | + (`see demo <https://ux.symfony.com/turbo>`_) |
| 105 | +* `ux-twig-component`_: Build Twig Components Backed by a PHP Class |
| 106 | + (`see demo <https://ux.symfony.com/twig-component>`_) |
| 107 | +* `ux-typed`_: Integration with `Typed`_ (`see demo <https://ux.symfony.com/typed>`_) |
| 108 | +* `ux-vue`_: Render `Vue`_ component from Twig (`see demo <https://ux.symfony.com/vue>`_) |
80 | 109 |
|
81 | 110 | Lazy Stimulus Controllers
|
82 | 111 | ~~~~~~~~~~~~~~~~~~~~~~~~~
|
@@ -110,6 +139,18 @@ To make a third-party controller lazy, in ``assets/controllers.json``, set
|
110 | 139 | If you write your controllers using TypeScript, make sure
|
111 | 140 | ``removeComments`` is not set to ``true`` in your TypeScript config.
|
112 | 141 |
|
| 142 | +Stimulus Tools around the World |
| 143 | +------------------------------- |
| 144 | + |
| 145 | +Because Stimulus is used by developers outside of Symfony, many tools |
| 146 | +exist beyond the UX packages: |
| 147 | + |
| 148 | +* `stimulus-use`_: Add composable behaviors to your Stimulus controllers, like |
| 149 | + debouncing, detecting outside clicks and many other things. |
| 150 | + |
| 151 | +* `stimulus-components`_ A large number of pre-made Stimulus controllers, like for |
| 152 | + Copying to clipboard, Sortable, Popover (similar to tooltips) and much more. |
| 153 | + |
113 | 154 | Stimulus Twig Helpers
|
114 | 155 | ---------------------
|
115 | 156 |
|
@@ -428,18 +469,41 @@ it will normalize it:
|
428 | 469 | <!-- will render as: -->
|
429 | 470 | <div data-controller="symfony--ux-chartjs--chart">
|
430 | 471 |
|
431 |
| -.. _Stimulus: https://stimulus.hotwired.dev/ |
432 |
| -.. _Webpack Encore: https://symfony.com/doc/current/frontend.html |
433 |
| -.. _AssetMapper: https://symfony.com/doc/current/frontend/asset-mapper.html |
434 |
| -.. _Symfony UX documentation: https://symfony.com/doc/current/frontend/ux.html |
435 |
| -.. _Stimulus Controllers & Values: https://stimulus.hotwired.dev/reference/values |
436 |
| -.. _CSS Classes: https://stimulus.hotwired.dev/reference/css-classes |
437 |
| -.. _Stimulus Actions: https://stimulus.hotwired.dev/reference/actions |
438 |
| -.. _parameters: https://stimulus.hotwired.dev/reference/actions#action-parameters |
439 |
| -.. _Stimulus Targets: https://stimulus.hotwired.dev/reference/targets |
440 |
| -.. _StimulusBundle Flex recipe: https://github.com/symfony/recipes/tree/main/symfony/stimulus-bundle |
441 |
| -.. _experimental: https://symfony.com/doc/current/contributing/code/experimental.html |
442 | 472 | .. _Encore vs AssetMapper: https://symfony.com/doc/current/frontend.html
|
443 | 473 | .. _Symfony Flex: https://symfony.com/doc/current/setup/flex.html
|
444 | 474 | .. _Stimulus Documentation: https://stimulus.hotwired.dev/
|
445 | 475 | .. _`@symfony/stimulus-bridge`: https://github.com/symfony/stimulus-bridge
|
| 476 | +.. _`Stimulus`: https://stimulus.hotwired.dev/ |
| 477 | +.. _`Webpack Encore`: https://symfony.com/doc/current/frontend.html |
| 478 | +.. _`AssetMapper`: https://symfony.com/doc/current/frontend/asset-mapper.html |
| 479 | +.. _`Stimulus Controllers & Values`: https://stimulus.hotwired.dev/reference/values |
| 480 | +.. _`CSS Classes`: https://stimulus.hotwired.dev/reference/css-classes |
| 481 | +.. _`Stimulus Actions`: https://stimulus.hotwired.dev/reference/actions |
| 482 | +.. _`parameters`: https://stimulus.hotwired.dev/reference/actions#action-parameters |
| 483 | +.. _`Stimulus Targets`: https://stimulus.hotwired.dev/reference/targets |
| 484 | +.. _`StimulusBundle Flex recipe`: https://github.com/symfony/recipes/tree/main/symfony/stimulus-bundle |
| 485 | +.. _`experimental`: https://symfony.com/doc/current/contributing/code/experimental.html |
| 486 | +.. _`ux-autocomplete`: https://symfony.com/bundles/ux-autocomplete/current/index.html |
| 487 | +.. _`ux-chartjs`: https://symfony.com/bundles/ux-chartjs/current/index.html |
| 488 | +.. _`ux-cropperjs`: https://symfony.com/bundles/ux-cropperjs/current/index.html |
| 489 | +.. _`ux-dropzone`: https://symfony.com/bundles/ux-dropzone/current/index.html |
| 490 | +.. _`ux-lazy-image`: https://symfony.com/bundles/ux-lazy-image/current/index.html |
| 491 | +.. _`ux-live-component`: https://symfony.com/bundles/ux-live-component/current/index.html |
| 492 | +.. _`ux-notify`: https://symfony.com/bundles/ux-notify/current/index.html |
| 493 | +.. _`ux-react`: https://symfony.com/bundles/ux-react/current/index.html |
| 494 | +.. _ux-translator: https://symfony.com/bundles/ux-translator/current/index.html |
| 495 | +.. _`ux-swup`: https://symfony.com/bundles/ux-swup/current/index.html |
| 496 | +.. _`ux-turbo`: https://symfony.com/bundles/ux-turbo/current/index.html |
| 497 | +.. _`ux-twig-component`: https://symfony.com/bundles/ux-twig-component/current/index.html |
| 498 | +.. _`ux-typed`: https://symfony.com/bundles/ux-typed/current/index.html |
| 499 | +.. _`ux-vue`: https://symfony.com/bundles/ux-vue/current/index.html |
| 500 | +.. _`ux-svelte`: https://symfony.com/bundles/ux-svelte/current/index.html |
| 501 | +.. _`Chart.js`: https://www.chartjs.org/ |
| 502 | +.. _`Swup`: https://swup.js.org/ |
| 503 | +.. _`React`: https://reactjs.org/ |
| 504 | +.. _`Svelte`: https://svelte.dev/ |
| 505 | +.. _`Turbo Drive`: https://turbo.hotwired.dev/ |
| 506 | +.. _`Typed`: https://github.com/mattboldt/typed.js/ |
| 507 | +.. _`Vue`: https://vuejs.org/ |
| 508 | +.. _`stimulus-use`: https://stimulus-use.github.io/stimulus-use |
| 509 | +.. _`stimulus-components`: https://stimulus-components.netlify.app/ |
0 commit comments