Choices
A switch, a dropdown, a row of pills or a checkbox list: the fields that pick from a closed set you declare.
Options
f.select(), f.radio() and f.checkboxes() take a list of options. Each option is a value, which is stored and what the view compares against, and a label, which editors read:
icon: f.select([{ value: "circle", label: "Circle" }, { value: "square", label: "Square" }, { value: "diamond", label: "Diamond" }]),A bare string is shorthand for an option whose label is its value: f.radio(["left", "center"]). The value's type in the view is the union of the option values, so a switch over it is exhaustive. An empty option list is an error at startup, and publish refuses a stored value that is not in the list.
The four fields
f.boolean()A switch.true or false. Never required: an untouched switch is false.f.select([…])A dropdown. .optional() adds an empty choice.One option value.f.radio([…])Pills in a row. .optional() adds a None pill that stores nothing.One option value.f.checkboxes([…])A checkbox per option.An array of option values, in option order whatever order they were ticked.Choose f.radio() for two to four options that fit on a row, and f.select() for longer lists. Smoodly's own styles use pills, so a radio in your settings looks the same.
Defaults
A choice usually has a right answer to start from. .default() sets it, and the form shows it while the field is untouched:
settings: {
imageSide: f.radio([{ value: "left", label: "Image left" }, { value: "right", label: "Image right" }]).default("left"),
},A boolean page field follows the same rule; the starter's showInNavigation defaults to true, so a new page appears in its parent's sub-navigation until an editor turns it off.
Next, Image, video and file.