diff --git a/docs/Fields/overview.mdx b/docs/Fields/overview.mdx index b09cb50586..bc28788361 100644 --- a/docs/Fields/overview.mdx +++ b/docs/Fields/overview.mdx @@ -4,11 +4,59 @@ label: Overview order: 10 --- -Collections are composed of any number of fields. Payload offers a wide-array of field-types - both simple and complex. + + Fields are the building blocks of Payload. Collections and Globals both use Fields to define the shape of the data that they store. Payload offers a wide-array of field-types - both simple and complex. + + +## Common Options + +Most fields have the ability to use the following options + +#### `defaultValue` + +Initial value for the field + +#### `required` + +`true/false` value if the field is required to be populated + +#### `localized` + +`true/false` value to enable localization on the field + +#### `admin` + +The `admin` is an optional object with properties that specify how the field should be represented in the admin interface. + +Properties: + +- `position` - If specified as `sidebar`, the field will show in the admin interface's sidebar +- `width` - A percentage value ie. `50%` that will control the max-width of the field +- `readOnly` - `true/false` to set the field to read-only after it is saved + +### Common Options Example + +```js +// Collection config +{ + fields: [ + { + name: 'my-field', + type: 'text', + label: 'Text', + admin: { + position: 'sidebar', + width: '50%', + readOnly: true, + } + } + ] +} +``` ## Field types -When configuring a field in a collection, there are multiple values to set for the `type`. This type determines how the input will be rendered in the admin interface, what values it can accept, and how it is presented in the API. +The `type` property on a field determines how the input will be rendered in the admin interface, what values it can accept, and how it is presented in the API. ```js // Collection config @@ -23,13 +71,6 @@ When configuring a field in a collection, there are multiple values to set for t } ``` -### Common Options - -- `defaultValue` -- `required` - boolean -- `localized` - boolean -- `admin` - _TODO: Document all options_ - ### Simple Types #### `text` diff --git a/docs/getting-started/concepts.mdx b/docs/getting-started/concepts.mdx index 0dbcb10d94..0f0b5b5dca 100644 --- a/docs/getting-started/concepts.mdx +++ b/docs/getting-started/concepts.mdx @@ -36,4 +36,4 @@ You can define as many Collections as you need. On each Collection, you can spec Fields are the building blocks of Payload. Collections and Globals both use Fields to define the shape of the data that they store. -Payload comes with many different types of Fields that give you a ton of flexibility while designing your API. Each Field type has its own potential properties that allow you to customize how they work. +Payload comes with [many different types](../fields/overview) of Fields that give you a ton of flexibility while designing your API. Each Field type has its own potential properties that allow you to customize how they work.