Skip to content

Commit 77ee62e

Browse files
committed
Replace chart examples by hello to avoid confusion with the ChartJS component
1 parent 61819ae commit 77ee62e

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/StimulusBundle/doc/index.rst

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ For example:
174174

175175
.. code-block:: html+twig
176176

177-
<div {{ stimulus_controller('chart', { 'name': 'Likes', 'data': [1, 2, 3, 4] }) }}>
177+
<div {{ stimulus_controller('hello', { 'name': 'World', 'data': [1, 2, 3, 4] }) }}>
178178
Hello
179179
</div>
180180

181181
<!-- would render -->
182182
<div
183-
data-controller="chart"
184-
data-chart-name-value="Likes"
185-
data-chart-data-value="&#x5B;1,2,3,4&#x5D;"
183+
data-controller="hello"
184+
data-hello-name-value="World"
185+
data-hello-data-value="&#x5B;1,2,3,4&#x5D;"
186186
>
187187
Hello
188188
</div>
@@ -191,49 +191,49 @@ If you want to set CSS classes:
191191

192192
.. code-block:: html+twig
193193

194-
<div {{ stimulus_controller('chart', { 'name': 'Likes', 'data': [1, 2, 3, 4] }, { 'loading': 'spinner' }) }}>
194+
<div {{ stimulus_controller('hello', { 'name': 'World', 'data': [1, 2, 3, 4] }, { 'loading': 'spinner' }) }}>
195195
Hello
196196
</div>
197197

198198
<!-- would render -->
199199
<div
200-
data-controller="chart"
201-
data-chart-name-value="Likes"
202-
data-chart-data-value="&#x5B;1,2,3,4&#x5D;"
203-
data-chart-loading-class="spinner"
200+
data-controller="hello"
201+
data-hello-name-value="World"
202+
data-hello-data-value="&#x5B;1,2,3,4&#x5D;"
203+
data-hello-loading-class="spinner"
204204
>
205205
Hello
206206
</div>
207207

208208
<!-- or without values -->
209-
<div {{ stimulus_controller('chart', controllerClasses = { 'loading': 'spinner' }) }}>
209+
<div {{ stimulus_controller('hello', controllerClasses: { 'loading': 'spinner' }) }}>
210210
Hello
211211
</div>
212212

213213
And with outlets:
214214

215215
.. code-block:: html+twig
216216

217-
<div {{ stimulus_controller('chart',
218-
{ 'name': 'Likes', 'data': [1, 2, 3, 4] },
217+
<div {{ stimulus_controller('hello',
218+
{ 'name': 'World', 'data': [1, 2, 3, 4] },
219219
{ 'loading': 'spinner' },
220220
{ 'other': '.target' } ) }}>
221221
Hello
222222
</div>
223223

224224
<!-- would render -->
225225
<div
226-
data-controller="chart"
227-
data-chart-name-value="Likes"
228-
data-chart-data-value="&#x5B;1,2,3,4&#x5D;"
229-
data-chart-loading-class="spinner"
230-
data-chart-other-outlet=".target"
226+
data-controller="hello"
227+
data-hello-name-value="World"
228+
data-hello-data-value="&#x5B;1,2,3,4&#x5D;"
229+
data-hello-loading-class="spinner"
230+
data-hello-other-outlet=".target"
231231
>
232232
Hello
233233
</div>
234234

235235
<!-- or without values/classes -->
236-
<div {{ stimulus_controller('chart', controllerOutlets = { 'other': '.target' }) }}>
236+
<div {{ stimulus_controller('hello', controllerOutlets: { 'other': '.target' }) }}>
237237
Hello
238238
</div>
239239

@@ -246,20 +246,20 @@ there's also a ``stimulus_controller`` filter:
246246

247247
.. code-block:: html+twig
248248

249-
<div {{ stimulus_controller('chart', { 'name': 'Likes' })|stimulus_controller('other-controller') }}>
249+
<div {{ stimulus_controller('hello', { 'name': 'World' })|stimulus_controller('other-controller') }}>
250250
Hello
251251
</div>
252252

253253
<!-- would render -->
254-
<div data-controller="chart other-controller" data-chart-name-value="Likes">
254+
<div data-controller="hello other-controller" data-hello-name-value="World">
255255
Hello
256256
</div>
257257

258258
You can also retrieve the generated attributes as an array, which can be helpful e.g. for forms:
259259

260260
.. code-block:: twig
261261
262-
{{ form_start(form, { attr: stimulus_controller('chart', { 'name': 'Likes' }).toArray() }) }}
262+
{{ form_start(form, { attr: stimulus_controller('hello', { 'name': 'World' }).toArray() }) }}
263263
264264
stimulus_action
265265
~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)