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.
list
fields
specified, the list widget defaults to a text input for entering comma-separated values; with fields
specified, the list widget contains a repeatable child widget, with controls for adding, deleting, and re-ordering the repeated widgets.Options:
default
: you may specify a list of strings to populate the basic text
field, or an array of list items for lists using the fields
option. If no
default is declared when using field
or fields
, will default to a single
list item using the defaults on the child widgetsallow_add
: false
hides the button to add additional itemscollapsed
: when true
, the entries collapse by defaultsummary
: specify the label displayed on collapsed entriesminimize_collapsed
: when true
, 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
: when true
, new entries will be added to the top of the listfield
/fields
not specified):- label: "Tags"
name: "tags"
widget: "list"
default: ["news"]
allow_add
marked false
):- label: "Tags"
name: "tags"
widget: "list"
allow_add: false
default: ["news"]
field
):- label: "Gallery"
name: "galleryImages"
widget: "list"
summary: ''
field: {label: Image, name: image, widget: image}
fields
):- label: "Testimonials"
name: "testimonials"
widget: "list"
summary: ' - '
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"}
default
):- label: "Gallery"
name: "galleryImages"
widget: "list"
fields:
- { label: "Source", name: "src", widget: "string" }
- { label: "Alt Text", name: "alt", widget: "string" }
default:
- { src: "/img/tennis.jpg", alt: "Tennis" }
- { src: "/img/footbar.jpg", alt: "Football" }
collapsed
marked false
):- 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 }
minimize_collapsed
marked true
):- 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 }
max
& min
):- label: "Tags"
name: "tags"
widget: "list"
max: 3
min: 1
default: ["news"]
add_to_top
marked true
):- label: "Tags"
name: "tags"
widget: "list"
add_to_top: true