Improve docs for select multiple (#9539)
* Readd original select multiple note * Update forms.md
Josh Hawkins committed
Oct 1, 2017 at 16:18 UTC
18d574a086f724f3437fd018d787a3110046a55c
1 file changed
+8
docs/docs/forms.md
+8
@@ -182,6 +182,14 @@ class FlavorForm extends React.Component {
182
183
Overall, this makes it so that `<input type="text">`, `<textarea>`, and `<select>` all work very similarly - they all accept a `value` attribute that you can use to implement a controlled component.
184
185
+> Note
186
+>
187
+> You can pass an array into the `value` attribute, allowing you to select multiple options in a `select` tag:
188
+>
189
+>```js
190
+><select multiple={true} value={['B', 'C']}>
191
+>```
192
+
193
## Handling Multiple Inputs
194
195
When you need to handle multiple controlled `input` elements, you can add a `name` attribute to each element and let the handler function choose what to do based on the value of `event.target.name`.