Choices and lists
Rows in a dialog
This lesson adds two things to a list: where its rows are edited, and how many there may be.
Where. Two short fields fit in a table row. Five do not: scroll the table on the right and see how cramped it is. editor: "dialog" lists each row as one line, and opens a dialog to add or edit it.
How many. A café needs at least two staff and has room for ten. min and max say so.
{
key: "staff",
type: "list",
label: "Staff",
item: "staff member",
editor: "dialog",
min: 2,
max: 10,
fields: [ … ],
},
Add all three to the list. It now starts empty, with an Add staff member button that opens the dialog. The section counts as done only once two people are in it, and when there are ten the button goes away.
wide: true gives the dialog more room when a row has many fields. Without min, a required list needs one row, and an optional one needs none.