Files
.github
dev-test
img
packages
scripts
website
content
blog
docs
widgets
boolean.md
date.md
datetime.md
file.md
hidden.md
image.md
index.md
list.md
markdown.md
number.md
object.md
relation.md
select.md
string.md
text.md
add-to-your-site.md
architecture.md
authentication-backends.md
beta-features.md
collection-types.md
configuration-options.md
contributor-guide.md
custom-widgets.md
customization.md
examples.md
intro.md
start-with-a-template.md
update-the-cms-version.md
pages
.keep
data
src
static
.babelrc
.eslintrc
.gitignore
.nvmrc
README.md
gatsby-browser.js
gatsby-config.js
gatsby-node.js
package.json
yarn.lock
.all-contributorsrc
.editorconfig
.gitignore
.nvmrc
.travis.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
babel.config.js
custom-preprocessor.js
jest.config.js
lerna.json
package.json
setupTestFramework.js
yarn.lock
static-cms/website/content/docs/widgets/list.md
2018-07-25 07:47:26 -04:00

1.8 KiB

label target
List list

The list widget allows you to create a repeatable item in the UI which saves as a list of widget values. map a user-provided string with a comma delimiter into a list. You can choose any widget as a child of a list widget—even other lists.

  • Name: list

  • UI: if fields is specified, field containing a repeatable child widget, with controls for adding, deleting, and re-ordering the repeated widgets; if unspecified, a text input for entering comma-separated values

  • Data type: list of widget values

  • Options:

    • default: if fields is specified, declare defaults on the child widgets; if not, you may specify a list of strings to populate the text field
    • allow_add: if added and labeled false, button to add additional widgets disapears
    • field: a single widget field to be repeated
    • fields: a nested list of multiple widget fields to be included in each repeatable iteration
  • Example (field/fields not specified):

    - label: "Tags"
      name: "tags"
      widget: "list"
      default: ["news"]
    
  • Example (allow_add marked false):

    - label: "Tags"
      name: "tags"
      widget: "list"
      allow_add: false
      default: ["news"]
    
  • Example (with field):

    - label: "Gallery"
      name: "galleryImages"
      widget: "list"
      field:
        - {label: Image, name: image, widget: image}
    
  • Example (with fields):

    - label: "Testimonials"
      name: "testimonials"
      widget: "list"
      fields:
        - {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
        - label: Author
          name: author
          widget: object
          fields:
            - {label: Name, name: name, widget: string, default: "Emmet"}
            - {label: Avatar, name: avatar, widget: image, default: "/img/emmet.jpg"}