feat(netlify-cms-widget-select): add support for multiple selection (#1901)

This commit is contained in:
Alexander Nanberg
2018-11-29 15:34:04 +01:00
committed by Shawn Erquhart
parent 944fe1b370
commit 88bf287221
7 changed files with 301 additions and 31 deletions

View File

@ -3,16 +3,17 @@ label: "Select"
title: select
---
The select widget allows you to pick a single string value from a dropdown menu.
The select widget allows you to pick a string value from a dropdown menu.
- **Name:** `select`
- **UI:** HTML select input
- **Data type:** string
- **UI:** select input
- **Data type:** string or array
- **Options:**
- `default`: accepts a string; defaults to an empty string
- `options`: (**required**) a list of options for the dropdown menu; can be listed in two ways:
- string values: the label displayed in the dropdown is the value saved in the file
- object with `label` and `value` fields: the label displays in the dropdown; the value is saved in the file
- `multiple`: accepts a boolean; defaults to `false`
- **Example** (options as strings):
```yaml
- label: "Align Content"
@ -30,4 +31,12 @@ The select widget allows you to pick a single string value from a dropdown menu.
- { label: "Paris", value: "CDG" }
- { label: "Tokyo", value: "HND" }
```
- **Example** (multiple):
```yaml
- label: "Tags"
name: "tags"
widget: "select"
multiple: true
options: ["Design", "UX", "Dev"]
```