File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
packages/site/src/routes/demo/select Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 4
4
Note: you need to provide a function as `key` that returns a unique string
5
5
for each option.
6
6
7
- It *must* be a string. (Hence the `${fruit && fruit.id}` part. That
8
- returns a string for the numberic `id` field and the `null` value even.)
7
+ It *must* be a string. (Hence the `${(fruit && fruit.id) || ''}` part.
8
+ That returns a string for the numberic `id` field and the `null` and
9
+ `undefined` values even.) If the string is empty (""), the label will stop
10
+ floating when that option is selected and the component is unfocused.
11
+ Therefore, the option for that value shouldn't have any text, or the
12
+ floating label will overlap it.
9
13
-->
10
14
<Select
11
- key ={(fruit ) => ` ${fruit && fruit .id } ` }
15
+ key ={(fruit ) => ` ${( fruit && fruit .id ) || ' ' } ` }
12
16
bind:value ={valueA }
13
17
label =" Standard"
14
18
>
26
30
<div >
27
31
<Select
28
32
variant =" filled"
29
- key ={(fruit ) => ` ${fruit && fruit .id } ` }
33
+ key ={(fruit ) => ` ${( fruit && fruit .id ) || ' ' } ` }
30
34
bind:value ={valueB }
31
35
label =" Filled"
32
36
>
44
48
<div >
45
49
<Select
46
50
variant =" outlined"
47
- key ={(fruit ) => ` ${fruit && fruit .id } ` }
51
+ key ={(fruit ) => ` ${( fruit && fruit .id ) || ' ' } ` }
48
52
bind:value ={valueC }
49
53
label =" Outlined"
50
54
>
You can’t perform that action at this time.
0 commit comments