.github
.storybook
__mocks__
cypress
dev-test
functions
img
packages
scripts
website
content
blog
docs
widgets
boolean.md
code.md
color.md
date.md
datetime.md
file.md
hidden.md
image.md
list.md
map.md
markdown.md
number.md
object.md
relation.md
select.md
string.md
text.md
add-to-your-site.md
architecture.md
azure-backend.md
backends-overview.md
beta-features.md
bitbucket-backend.md
cloudinary.md
collection-types.md
configuration-options.md
contributor-guide.md
custom-widgets.md
customization.md
deploy-preview-links.md
examples.md
external-oauth-clients.md
gatsby.md
git-gateway-backend.md
github-backend.md
gitlab-backend.md
gridsome.md
hugo.md
intro.md
jekyll.md
middleman.md
netlify-large-media.md
nextjs.md
nuxt.md
open-authoring.md
releases.md
site-generator-overview.md
start-with-a-template.md
test-backend.md
uploadcare.md
widgets.md
writing-style-guide.md
pages
.keep
data
src
static
.babelrc
.gitignore
.markdownlint.json
.nvmrc
README.md
gatsby-browser.js
gatsby-config.js
gatsby-node.js
netlify.toml
package.json
site.yml
yarn.lock
.all-contributorsrc
.editorconfig
.eslintrc.js
.gitattributes
.gitignore
.nvmrc
.prettierignore
.prettierrc
.stylelintrc
.vale.ini
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
babel.config.js
cms.png
commitlint.config.js
cypress.json
jest.config.js
lerna.json
netlify.toml
package.json
renovate.json
setupTestFramework.js
tsconfig.json
yarn.lock
3.7 KiB
3.7 KiB
title | label |
---|---|
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: without any
fields
specified, the list widget defaults to a text input for entering comma-separated values; withfields
specified, the list widget contains a repeatable child widget, with controls for adding, deleting, and re-ordering the repeated widgets. -
Data type: list of widget values
-
Options:
default
: you may specify a list of strings to populate the basic text field, or an array of list items for lists using thefields
option. If no default is declared when usingfield
orfields
, will default to a single list item using the defaults on the child widgetsallow_add
:false
hides the button to add additional itemscollapsed
: whentrue
, the entries collapse by defaultsummary
: specify the label displayed on collapsed entriesminimize_collapsed
: whentrue
, collapsing the list widget will hide all of it's entries instead of showing summarieslabel_singular
: the text to show on the add buttonfield
: a single widget field to be repeatedfields
: a nested list of multiple widget fields to be included in each repeatable iterationmax
: maximum number of items in the listmin
: minimum number of items in the listadd_to_top
: whentrue
, new entries will be added to the top of the list
-
Example (
field
/fields
not specified):
- label: "Tags"
name: "tags"
widget: "list"
default: ["news"]
- Example (
allow_add
markedfalse
):
- label: "Tags"
name: "tags"
widget: "list"
allow_add: false
default: ["news"]
- Example (with
field
):
- label: "Gallery"
name: "galleryImages"
widget: "list"
summary: '{{fields.image}}'
field: {label: Image, name: image, widget: image}
- Example (with
fields
):
- label: "Testimonials"
name: "testimonials"
widget: "list"
summary: '{{fields.quote}} - {{fields.author.name}}'
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"}
- Example (with
default
):
- label: "Gallery"
name: "galleryImages"
widget: "list"
fields:
- { label: "Source", name: "src", widget: "string" }
- { label: "Alt Text", name: "alt", widget: "string" }
default:
- { src: "/img/tenis.jpg", alt: "Tenis" }
- { src: "/img/footbar.jpg", alt: "Football" }
- Example (
collapsed
markedfalse
):
- label: "Testimonials"
name: "testimonials"
collapsed: false
widget: "list"
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- {label: Author, name: author, widget: string }
- Example (
minimize_collapsed
markedtrue
):
- label: "Testimonials"
name: "testimonials"
minimize_collapsed: true
widget: "list"
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- {label: Author, name: author, widget: string }
- Example (with
max
&min
):
- label: "Tags"
name: "tags"
widget: "list"
max: 3
min: 1
default: ["news"]
- Example (
add_to_top
markedtrue
):
- label: "Tags"
name: "tags"
widget: "list"
add_to_top: true