Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic documentation for select widget #806

Merged
merged 1 commit into from
Dec 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ Widgets define the data type and interface for entry fields. Netlify CMS comes w

We’re always adding new widgets, and you can also [create your own](/docs/extending)!

### Select Widget

The select widget allows you to pick a string value from a drop down menu

```yaml
collections:
- name: posts
label: Post
folder: "_posts"
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
create: true
fields:
- {label: Title, name: title, widget: string, tagname: h1}
- {label: Body, name: body, widget: markdown}
- {label: Align Content, name: align, widget: select, options: ['left', 'center', 'right']}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing #764 requires documentation of adding labels and values, would you mind adding an example of that, too? You could even trim this code sample down and just show the field config examples, e.g.:

collections:
  - name: posts
     ...
     fields:
       ...
       - { label: Align Content, <rest of field> }
       - { label: Other example, <rest of field> }

```

### List Widget

The list widget allows you to map a user-provided string with a comma delimiter into a list. Consider the following example that also demonstrates how to set default values:
Expand Down