File tree 4 files changed +70
-46
lines changed
docs/data/material/components/autocomplete
4 files changed +70
-46
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,17 @@ export default function FixedTags() {
21
21
options = { top100Films }
22
22
getOptionLabel = { ( option ) => option . title }
23
23
renderTags = { ( tagValue , getTagProps ) =>
24
- tagValue . map ( ( option , index ) => (
25
- < Chip
26
- label = { option . title }
27
- { ...getTagProps ( { index } ) }
28
- disabled = { fixedOptions . indexOf ( option ) !== - 1 }
29
- />
30
- ) )
24
+ tagValue . map ( ( option , index ) => {
25
+ const { key, ...tagProps } = getTagProps ( { index } ) ;
26
+ return (
27
+ < Chip
28
+ key = { key }
29
+ label = { option . title }
30
+ { ...tagProps }
31
+ disabled = { fixedOptions . indexOf ( option ) !== - 1 }
32
+ />
33
+ ) ;
34
+ } )
31
35
}
32
36
style = { { width : 500 } }
33
37
renderInput = { ( params ) => (
Original file line number Diff line number Diff line change @@ -21,13 +21,17 @@ export default function FixedTags() {
21
21
options = { top100Films }
22
22
getOptionLabel = { ( option ) => option . title }
23
23
renderTags = { ( tagValue , getTagProps ) =>
24
- tagValue . map ( ( option , index ) => (
25
- < Chip
26
- label = { option . title }
27
- { ...getTagProps ( { index } ) }
28
- disabled = { fixedOptions . indexOf ( option ) !== - 1 }
29
- />
30
- ) )
24
+ tagValue . map ( ( option , index ) => {
25
+ const { key, ...tagProps } = getTagProps ( { index } ) ;
26
+ return (
27
+ < Chip
28
+ key = { key }
29
+ label = { option . title }
30
+ { ...tagProps }
31
+ disabled = { fixedOptions . indexOf ( option ) !== - 1 }
32
+ />
33
+ ) ;
34
+ } )
31
35
}
32
36
style = { { width : 500 } }
33
37
renderInput = { ( params ) => (
Original file line number Diff line number Diff line change @@ -66,14 +66,18 @@ export default function Sizes() {
66
66
getOptionLabel = { ( option ) => option . title }
67
67
defaultValue = { top100Films [ 13 ] }
68
68
renderTags = { ( value , getTagProps ) =>
69
- value . map ( ( option , index ) => (
70
- < Chip
71
- variant = "outlined"
72
- label = { option . title }
73
- size = "small"
74
- { ...getTagProps ( { index } ) }
75
- />
76
- ) )
69
+ value . map ( ( option , index ) => {
70
+ const { key, ...tagProps } = getTagProps ( { index } ) ;
71
+ return (
72
+ < Chip
73
+ key = { key }
74
+ variant = "outlined"
75
+ label = { option . title }
76
+ size = "small"
77
+ { ...tagProps }
78
+ />
79
+ ) ;
80
+ } )
77
81
}
78
82
renderInput = { ( params ) => (
79
83
< TextField
@@ -92,14 +96,18 @@ export default function Sizes() {
92
96
getOptionLabel = { ( option ) => option . title }
93
97
defaultValue = { [ top100Films [ 13 ] ] }
94
98
renderTags = { ( value , getTagProps ) =>
95
- value . map ( ( option , index ) => (
96
- < Chip
97
- variant = "outlined"
98
- label = { option . title }
99
- size = "small"
100
- { ...getTagProps ( { index } ) }
101
- />
102
- ) )
99
+ value . map ( ( option , index ) => {
100
+ const { key, ...tagProps } = getTagProps ( { index } ) ;
101
+ return (
102
+ < Chip
103
+ key = { key }
104
+ variant = "outlined"
105
+ label = { option . title }
106
+ size = "small"
107
+ { ...tagProps }
108
+ />
109
+ ) ;
110
+ } )
103
111
}
104
112
renderInput = { ( params ) => (
105
113
< TextField
Original file line number Diff line number Diff line change @@ -66,14 +66,18 @@ export default function Sizes() {
66
66
getOptionLabel = { ( option ) => option . title }
67
67
defaultValue = { top100Films [ 13 ] }
68
68
renderTags = { ( value , getTagProps ) =>
69
- value . map ( ( option , index ) => (
70
- < Chip
71
- variant = "outlined"
72
- label = { option . title }
73
- size = "small"
74
- { ...getTagProps ( { index } ) }
75
- />
76
- ) )
69
+ value . map ( ( option , index ) => {
70
+ const { key, ...tagProps } = getTagProps ( { index } ) ;
71
+ return (
72
+ < Chip
73
+ key = { key }
74
+ variant = "outlined"
75
+ label = { option . title }
76
+ size = "small"
77
+ { ...tagProps }
78
+ />
79
+ ) ;
80
+ } )
77
81
}
78
82
renderInput = { ( params ) => (
79
83
< TextField
@@ -92,14 +96,18 @@ export default function Sizes() {
92
96
getOptionLabel = { ( option ) => option . title }
93
97
defaultValue = { [ top100Films [ 13 ] ] }
94
98
renderTags = { ( value , getTagProps ) =>
95
- value . map ( ( option , index ) => (
96
- < Chip
97
- variant = "outlined"
98
- label = { option . title }
99
- size = "small"
100
- { ...getTagProps ( { index } ) }
101
- />
102
- ) )
99
+ value . map ( ( option , index ) => {
100
+ const { key, ...tagProps } = getTagProps ( { index } ) ;
101
+ return (
102
+ < Chip
103
+ key = { key }
104
+ variant = "outlined"
105
+ label = { option . title }
106
+ size = "small"
107
+ { ...tagProps }
108
+ />
109
+ ) ;
110
+ } )
103
111
}
104
112
renderInput = { ( params ) => (
105
113
< TextField
You can’t perform that action at this time.
0 commit comments