Skip to content

Commit 77fb2d3

Browse files
committed
/decaporg/decap-cms/issues/7383 widget setting required is not for all widgets
1 parent 407fdaa commit 77fb2d3

15 files changed

+15
-2
lines changed

content/docs/widgets.md

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ To see working examples of all of the built-in widgets, try making a 'Kitchen Si
1414

1515
The following options are available on all fields:
1616

17-
- `required`: specify as `false` to make a field optional; defaults to `true`
1817
- `hint`: optionally add helper text directly below a widget. Useful for including instructions. Accepts markdown for bold, italic, strikethrough, and links.
1918
- `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)
2019
- **Example:**

content/docs/widgets/boolean.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The boolean widget translates a toggle switch input to a true/false value.
1010
- **Data type:** boolean
1111
- **Options:**
1212
- `default`: accepts `true` or `false`; defaults to `false` when `required` is set to `false`
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
- **Example:**
1415
```yaml
1516
- {label: "Draft", name: "draft", widget: "boolean", default: true}

content/docs/widgets/code.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The code widget provides a code editor (powered by [Codemirror](https://codemirr
99
- **UI:** code editor
1010
- **Data type:** string
1111
- **Options:**
12+
- `required`: specify as `false` to make a field optional; defaults to `true`
1213
- `default_language`: optional; default language to use
1314
- `allow_language_selection`: optional; defaults to `false`: allows syntax to be changed
1415
- `keys`: optional; sets key names for code and lang if outputting an object; defaults to `{ code: 'code', lang: 'lang' }`

content/docs/widgets/color.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The color widget translates a color picker to a color string.
1010
- **Data type:** string
1111
- **Options:**
1212
- `default`: accepts a string; defaults to an empty string. Sets the default value
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
- `allowInput`: accepts a boolean, defaults to `false`. Allows manual editing of the color input value
1415
- `enableAlpha`: accepts a boolean, defaults to `false`. Enables Alpha editing
1516
- **Example:**

content/docs/widgets/datetime.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The datetime widget translates a datetime picker to a datetime string.
1616
- `default`: accepts a datetime string, or `'{{now}}'` to fill in the current datetime; otherwise defaults to empty string.
1717

1818
<small>Until 3.2.1 it defaults to current datetime. To get an empty field, set default to empty string.</small>
19+
- `required`: specify as `false` to make a field optional; defaults to `true`
1920
- `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.
2021
- `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).
2122
- `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.

content/docs/widgets/file.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The file widget allows editors to upload a file or select an existing one from t
1010
* **Options:**
1111

1212
* `default`: accepts a file path string; defaults to null
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
* `media_library`: media library settings to apply when a media library is opened by the
1415
current widget
1516

content/docs/widgets/hidden.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Hidden widgets do not display in the UI. In folder collections that allow users
1010
- **Data type:** any valid data type
1111
- **Options:**
1212
- `default`: accepts any valid data type; recommended for collections that allow adding new items
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
- **Example:**
1415
```yaml
1516
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}

content/docs/widgets/image.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The image widget allows editors to upload an image or select an existing one fro
1010
* **Options:**
1111

1212
* `default`: accepts a file path string; defaults to null
13+
* `required`: specify as `false` to make a field optional; defaults to `true`
1314
* `media_library`: settings to apply when a media library is opened by the
1415
current widget
1516
* `allow_multiple`: *(default: `true`)* when set to `false`, multiple selection will be disabled even if the media library extension supports it

content/docs/widgets/map.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ The map widget allows you to edit spatial data using an interactive map. Spatial
1111

1212
* `decimals`: accepts a number to specify precision of saved coordinates; defaults to 7 decimals
1313
* `default`: accepts a GeoJSON string containing a single geometry; defaults to an empty string
14+
* `required`: specify as `false` to make a field optional; defaults to `true`
1415
* `type`: accepts one string value of `Point`, `LineString` or `Polygon`; defaults to `Point`
1516
* **Example:**
1617

1718
```yaml
1819
- {label: "Location", name: "location", widget: "map" }
19-
```
20+
```

content/docs/widgets/markdown.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The markdown widget provides a full fledged text editor allowing users to format
1212
* **Options:**
1313

1414
* `default`: accepts markdown content
15+
* `required`: specify as `false` to make a field optional; defaults to `true`
1516
* `minimal`: accepts a boolean value, `false` by default. Sets the widget height to minimum possible.
1617
* `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`.
1718
* `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).

content/docs/widgets/number.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The number widget uses an HTML number input, saving the value as a string, integ
1010
- **Data type:** string by default; configured by `value_type` option
1111
- **Options:**
1212
- `default`: accepts string or number value; defaults to empty string
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
- `value_type`: accepts `int` or `float`; any other value results in saving as a string
1415
- `min`: accepts a number for minimum value accepted; unset by default
1516
- `max`: accepts a number for maximum value accepted; unset by default

content/docs/widgets/relation.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The relation widget allows you to reference items from another collection. It pr
1515
* `file`: allows referencing a specific file when the referenced collection is a files collection (string)
1616
* `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*.
1717
* `default`: accepts any widget data type; defaults to an empty string
18+
* `required`: specify as `false` to make a field optional; defaults to `true`
1819
* `multiple` : accepts a boolean, defaults to `false`
1920
* `min`: minimum number of items; ignored if **multiple** is `false`
2021
* `max`: maximum number of items; ignored if **multiple** is `false`

content/docs/widgets/select.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The select widget allows you to pick a string value from a dropdown menu.
1313

1414
* 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.
1515
* 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
16+
* `required`: specify as `false` to make a field optional; defaults to `true`
1617
* `options`: (**required**) there are two ways to list of options for the dropdown menu:
1718

1819
* string values: the dropdown displays the value directly

content/docs/widgets/string.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The string widget translates a basic text input to a string value. For larger te
1010
- **Data type:** string
1111
- **Options:**
1212
- `default`: accepts a string; defaults to an empty string
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
- **Example:**
1415
```yaml
1516
- {label: "Title", name: "title", widget: "string"}

content/docs/widgets/text.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The text widget takes a multiline text field and saves it as a string. For short
1010
- **Data type:** string
1111
- **Options:**
1212
- `default`: accepts a string; defaults to an empty string
13+
- `required`: specify as `false` to make a field optional; defaults to `true`
1314
- **Example:**
1415
```yaml
1516
- {label: "Description", name: "description", widget: "text"}

0 commit comments

Comments
 (0)