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
The `DualListBox` is a [controlled][react-controlled] component, so you have to update the `selected` property in conjunction with the `onChange` handler if you want the selected values to change.
44
+
The `DualListBox` is a [controlled][react-controlled] component. You must update the `selected` property in conjunction with the `onChange` handler if you want the selected values to change.
45
45
46
46
Here is a minimal rendering of the component:
47
47
@@ -62,15 +62,15 @@ function Widget() {
62
62
<DualListBox
63
63
options={options}
64
64
selected={selected}
65
-
onChange={(value) =>setSelected(value)}
65
+
onChange={(newValue) =>setSelected(newValue)}
66
66
/>
67
67
);
68
68
}
69
69
```
70
70
71
71
### Optgroups
72
72
73
-
Traditional `<optgroup>`'s are also supported:
73
+
This component also supports traditional `<optgroup>` elements through the use of the `options` key:
74
74
75
75
```jsx
76
76
constoptions= [
@@ -137,7 +137,7 @@ You can enable filtering of available and selected options by merely passing in
137
137
<DualListBox canFilter options={options} />
138
138
```
139
139
140
-
Optionally, you can also override the default filter placeholder text and the filtering function:
140
+
Optionally, you can also override the default filtering function:
141
141
142
142
```jsx
143
143
<DualListBox
@@ -153,7 +153,7 @@ Optionally, you can also override the default filter placeholder text and the fi
153
153
/>
154
154
```
155
155
156
-
In addition, you can control the filter search text, rather than leaving it up to the component:
156
+
In addition, you may control the filter text state, rather than leaving it up to the component:
157
157
158
158
```jsx
159
159
<DualListBox
@@ -164,14 +164,14 @@ In addition, you can control the filter search text, rather than leaving it up t
164
164
}}
165
165
options={options}
166
166
onFilterChange={(filter) => {
167
-
console.log(filter;
167
+
console.log(filter);
168
168
}}
169
169
/>
170
170
```
171
171
172
172
### Action/Button Alignment
173
173
174
-
By default, the component arranges movement buttons to the center. Another option is to align these actions to be above their respective lists:
174
+
By default, the component arranges the action buttons to the center. Another option is to align these actions to be above their respective lists:
@@ -181,7 +181,7 @@ By default, the component arranges movement buttons to the center. Another optio
181
181
182
182
By default, `react-dual-listbox` will order any selected items according to the order of the `options` property. There may be times in which you wish to preserve the selection order instead. In this case, you can add the `preserveSelectOrder` property.
183
183
184
-
> **Note** – Any `<optgroup>`'s supplied will not be surfaced when preserving the selection order.
184
+
> **Note**–Enabling this option hides `<optgroup>` associations in the selected listbox.
0 commit comments