diff --git a/content/docs/widgets.md b/content/docs/widgets.md index c1057d59..dc0e7d9d 100644 --- a/content/docs/widgets.md +++ b/content/docs/widgets.md @@ -15,7 +15,6 @@ To see working examples of all of the built-in widgets, try making a 'Kitchen Si The following options are available on all fields: -- `required`: specify as `false` to make a field optional; defaults to `true` - `hint`: optionally add helper text directly below a widget. Useful for including instructions. Accepts markdown for bold, italic, strikethrough, and links. - `pattern`: add field validation by specifying a list with a [regex pattern](https://regexr.com/) and an error message; more extensive validation can be achieved with [custom widgets](../custom-widgets/#advanced-field-validation) - **Example:** diff --git a/content/docs/widgets/boolean.md b/content/docs/widgets/boolean.md index 30b71349..cf1f2258 100644 --- a/content/docs/widgets/boolean.md +++ b/content/docs/widgets/boolean.md @@ -10,6 +10,7 @@ The boolean widget translates a toggle switch input to a true/false value. - **Data type:** boolean - **Options:** - `default`: accepts `true` or `false`; defaults to `false` when `required` is set to `false` + - `required`: specify as `false` to make a field optional; defaults to `true` - **Example:** ```yaml - {label: "Draft", name: "draft", widget: "boolean", default: true} diff --git a/content/docs/widgets/code.md b/content/docs/widgets/code.md index 01ee267e..ef407b8d 100644 --- a/content/docs/widgets/code.md +++ b/content/docs/widgets/code.md @@ -9,6 +9,7 @@ The code widget provides a code editor (powered by [Codemirror](https://codemirr - **UI:** code editor - **Data type:** string - **Options:** + - `required`: specify as `false` to make a field optional; defaults to `true` - `default_language`: optional; default language to use - `allow_language_selection`: optional; defaults to `false`: allows syntax to be changed - `keys`: optional; sets key names for code and lang if outputting an object; defaults to `{ code: 'code', lang: 'lang' }` diff --git a/content/docs/widgets/color.md b/content/docs/widgets/color.md index 97495c79..700655c3 100644 --- a/content/docs/widgets/color.md +++ b/content/docs/widgets/color.md @@ -10,6 +10,7 @@ The color widget translates a color picker to a color string. - **Data type:** string - **Options:** - `default`: accepts a string; defaults to an empty string. Sets the default value + - `required`: specify as `false` to make a field optional; defaults to `true` - `allowInput`: accepts a boolean, defaults to `false`. Allows manual editing of the color input value - `enableAlpha`: accepts a boolean, defaults to `false`. Enables Alpha editing - **Example:** diff --git a/content/docs/widgets/datetime.md b/content/docs/widgets/datetime.md index a0fab244..e27c2093 100644 --- a/content/docs/widgets/datetime.md +++ b/content/docs/widgets/datetime.md @@ -16,6 +16,7 @@ The datetime widget translates a datetime picker to a datetime string. - `default`: accepts a datetime string, or `'{{now}}'` to fill in the current datetime; otherwise defaults to empty string. Until 3.2.1 it defaults to current datetime. To get an empty field, set default to empty string. + - `required`: specify as `false` to make a field optional; defaults to `true` - `format`: sets storage format, displays the full date and time input in the UI. Accepts [Day.js formats](https://day.js.org/docs/en/display/format); defaults to ISO8601 (if supported by output format). If set, `date_format` and `time_format` are not used. - `date_format`: sets storage format and UI input type as date picker (without time). Boolean or [Day.js formats](https://day.js.org/docs/en/display/format). - `time_format`: sets storage format and UI input type as time picker (without date). Boolean or [Day.js formats](https://day.js.org/docs/en/display/format). If used together with `date_format`, the UI input will be a full datetime picker. diff --git a/content/docs/widgets/file.md b/content/docs/widgets/file.md index 49874070..63d9a6a4 100644 --- a/content/docs/widgets/file.md +++ b/content/docs/widgets/file.md @@ -10,6 +10,7 @@ The file widget allows editors to upload a file or select an existing one from t * **Options:** * `default`: accepts a file path string; defaults to null + - `required`: specify as `false` to make a field optional; defaults to `true` * `media_library`: media library settings to apply when a media library is opened by the current widget diff --git a/content/docs/widgets/hidden.md b/content/docs/widgets/hidden.md index 3fe738b1..547be627 100644 --- a/content/docs/widgets/hidden.md +++ b/content/docs/widgets/hidden.md @@ -10,6 +10,7 @@ Hidden widgets do not display in the UI. In folder collections that allow users - **Data type:** any valid data type - **Options:** - `default`: accepts any valid data type; recommended for collections that allow adding new items + - `required`: specify as `false` to make a field optional; defaults to `true` - **Example:** ```yaml - {label: "Layout", name: "layout", widget: "hidden", default: "blog"} diff --git a/content/docs/widgets/image.md b/content/docs/widgets/image.md index 51514120..93682d72 100644 --- a/content/docs/widgets/image.md +++ b/content/docs/widgets/image.md @@ -10,6 +10,7 @@ The image widget allows editors to upload an image or select an existing one fro * **Options:** * `default`: accepts a file path string; defaults to null + * `required`: specify as `false` to make a field optional; defaults to `true` * `media_library`: settings to apply when a media library is opened by the current widget * `allow_multiple`: *(default: `true`)* when set to `false`, multiple selection will be disabled even if the media library extension supports it diff --git a/content/docs/widgets/list.md b/content/docs/widgets/list.md index d11b6852..134e3fc6 100644 --- a/content/docs/widgets/list.md +++ b/content/docs/widgets/list.md @@ -13,6 +13,7 @@ The list widget allows you to create a repeatable item in the UI which saves as 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 widgets + * `required`: specify as `false` to ignore `min`, `max` setting; defaults to `true`. If `true` and `min`,`max` values are set, list widget validates number of items * `allow_add`: `false` hides the button to add additional items * `collapsed`: when `true`, the entries collapse by default * `summary`: specify the label displayed on collapsed entries diff --git a/content/docs/widgets/map.md b/content/docs/widgets/map.md index eb4b2bf6..8a534a70 100644 --- a/content/docs/widgets/map.md +++ b/content/docs/widgets/map.md @@ -11,9 +11,10 @@ The map widget allows you to edit spatial data using an interactive map. Spatial * `decimals`: accepts a number to specify precision of saved coordinates; defaults to 7 decimals * `default`: accepts a GeoJSON string containing a single geometry; defaults to an empty string + * `required`: specify as `false` to make a field optional; defaults to `true` * `type`: accepts one string value of `Point`, `LineString` or `Polygon`; defaults to `Point` * **Example:** ```yaml - {label: "Location", name: "location", widget: "map" } - ``` \ No newline at end of file + ``` diff --git a/content/docs/widgets/markdown.md b/content/docs/widgets/markdown.md index 70043a1c..f07c8ac8 100644 --- a/content/docs/widgets/markdown.md +++ b/content/docs/widgets/markdown.md @@ -12,6 +12,7 @@ The markdown widget provides a full fledged text editor allowing users to format * **Options:** * `default`: accepts markdown content + * `required`: specify as `false` to make a field optional; defaults to `true` * `minimal`: accepts a boolean value, `false` by default. Sets the widget height to minimum possible. * `buttons`: an array of strings representing the formatting buttons to display (all shown by default). Buttons include: `bold`, `italic`, `code`, `link`, `heading-one`, `heading-two`, `heading-three`, `heading-four`, `heading-five`, `heading-six`, `quote`, `bulleted-list`, and `numbered-list`. * `editor_components`: an array of strings representing the names of editor components to display (all shown by default). Decap CMS includes `image` and `code-block` editor components by default, and custom components may be [created and registered](/docs/custom-widgets/#registereditorcomponent). diff --git a/content/docs/widgets/number.md b/content/docs/widgets/number.md index e0ea666e..7523c665 100644 --- a/content/docs/widgets/number.md +++ b/content/docs/widgets/number.md @@ -10,6 +10,7 @@ The number widget uses an HTML number input, saving the value as a string, integ - **Data type:** string by default; configured by `value_type` option - **Options:** - `default`: accepts string or number value; defaults to empty string + - `required`: specify as `false` to make a field optional; defaults to `true` - `value_type`: accepts `int` or `float`; any other value results in saving as a string - `min`: accepts a number for minimum value accepted; unset by default - `max`: accepts a number for maximum value accepted; unset by default diff --git a/content/docs/widgets/relation.md b/content/docs/widgets/relation.md index bccafe72..e18679d5 100644 --- a/content/docs/widgets/relation.md +++ b/content/docs/widgets/relation.md @@ -15,6 +15,7 @@ The relation widget allows you to reference items from another collection. It pr * `file`: allows referencing a specific file when the referenced collection is a files collection (string) * `display_fields`: list of one or more names of fields in the referenced collection that will render in the autocomplete menu of the control. Defaults to `value_field`. Syntax to reference nested fields is similar to that of *value_field*. * `default`: accepts any widget data type; defaults to an empty string + * `required`: specify as `false` to make a field optional; defaults to `true` * `multiple` : accepts a boolean, defaults to `false` * `min`: minimum number of items; ignored if **multiple** is `false` * `max`: maximum number of items; ignored if **multiple** is `false` diff --git a/content/docs/widgets/select.md b/content/docs/widgets/select.md index 5377cc51..79a78a20 100644 --- a/content/docs/widgets/select.md +++ b/content/docs/widgets/select.md @@ -13,6 +13,7 @@ The select widget allows you to pick a string value from a dropdown menu. * string values: accepts a string; defaults to an empty string. Accepts an array of strings and defaults to an empty array with `multiple: true` enabled. * object with `label` and `value` fields: accepts an object with `label` and `value` field or an array of such objects when `multiple: true` is enable. Defaults to no value + * `required`: specify as `false` to make a field optional; defaults to `true` * `options`: (**required**) there are two ways to list of options for the dropdown menu: * string values: the dropdown displays the value directly diff --git a/content/docs/widgets/string.md b/content/docs/widgets/string.md index fdffbfd4..07a71119 100644 --- a/content/docs/widgets/string.md +++ b/content/docs/widgets/string.md @@ -10,6 +10,7 @@ The string widget translates a basic text input to a string value. For larger te - **Data type:** string - **Options:** - `default`: accepts a string; defaults to an empty string + - `required`: specify as `false` to make a field optional; defaults to `true` - **Example:** ```yaml - {label: "Title", name: "title", widget: "string"} diff --git a/content/docs/widgets/text.md b/content/docs/widgets/text.md index 46f287e5..9d3ed9cd 100644 --- a/content/docs/widgets/text.md +++ b/content/docs/widgets/text.md @@ -10,6 +10,7 @@ The text widget takes a multiline text field and saves it as a string. For short - **Data type:** string - **Options:** - `default`: accepts a string; defaults to an empty string + - `required`: specify as `false` to make a field optional; defaults to `true` - **Example:** ```yaml - {label: "Description", name: "description", widget: "text"}