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
Exposed named blocks from the underlying `toucan-core` components. This allows users to add custom content in `:hint` or `:label` named blocks. You can combine the arguments and named blocks as well! Below are some examples.
6
+
7
+
```hbs
8
+
<ToucanForm @data={{data}} as |form|>
9
+
<form.Textarea @name='comment'>
10
+
<:label>Label</:label>
11
+
<:hint>Hint</:hint>
12
+
</form.Textarea>
13
+
</ToucanForm>
14
+
```
15
+
16
+
```hbs
17
+
<ToucanForm @data={{data}} as |form|>
18
+
<form.Textarea @label='Label' @name='comment'>
19
+
<:hint>Hint</:hint>
20
+
</form.Textarea>
21
+
</ToucanForm>
22
+
```
23
+
24
+
```hbs
25
+
<ToucanForm @data={{data}} as |form|>
26
+
<form.Textarea @hint='Hint' @name='comment'>
27
+
<:label>Label</:label>
28
+
</form.Textarea>
29
+
</ToucanForm>
30
+
```
31
+
32
+
Or you can continue to use the arguments if you're only working with strings!
This looks really messy, but Form::Fields::CheckboxGroup exposes named blocks; HOWEVER,
5
+
we cannot conditionally render named blocks due to https://github.com/emberjs/rfcs/issues/735.
6
+
7
+
We *can* conditionally render components though, based on the blocks and argument combinations
8
+
users provide us. This is very brittle, but until https://github.com/emberjs/rfcs/issues/735
9
+
is resolved and a solution is found, this appears to be the only way to truly expose
10
+
conditional named blocks.
11
+
12
+
---
13
+
14
+
Regarding glint-expect-error
15
+
16
+
"@onChange" of the checkbox-group only expects an array of strings typed value, but field.setValue is generic,
17
+
accepting anything that DATA[KEY] could be. Similar case with "@isChecked", but there casting to
18
+
an array of strings is easy.
19
+
}}
1
20
<@form.Field @name={{@name}} as |field|>
2
-
<Form::Fields::CheckboxGroup
3
-
@label={{@label}}
4
-
@hint={{@hint}}
5
-
@error={{this.mapErrorsfield.rawErrors}}
6
-
@value={{this.assertArrayOfStringsfield.value}}
7
-
{{! The issue here is that onChange only expects a string typed value, but field.setValue is generic, accepting anything that DATA[KEY] could be. Similar case with @value, but there casting is easy. }}
0 commit comments