From b4984735adeb65deef35b13b170a597bae60616e Mon Sep 17 00:00:00 2001 From: "tina-cloud-app[bot]" <58178390+tina-cloud-app[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:35:33 +1000 Subject: [PATCH] Object Summary (#2252) * TinaCMS content update * TinaCMS content update * TinaCMS content update * TinaCMS content update * TinaCMS content update * TinaCMS content update * TinaCMS content update * TinaCMS content update * Update astro.json * Update object.mdx --------- Co-authored-by: tina-cloud-app[bot] <58178390+tina-cloud-app[bot]@users.noreply.github.com> Co-authored-by: Isaac Lombard [SSW] <152236421+isaaclombardssw@users.noreply.github.com> --- content/docs/reference/types/object.mdx | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/content/docs/reference/types/object.mdx b/content/docs/reference/types/object.mdx index 76f83892e..eba01839b 100644 --- a/content/docs/reference/types/object.mdx +++ b/content/docs/reference/types/object.mdx @@ -1,12 +1,16 @@ --- title: The "object" field -last_edited: '2024-09-12T01:50:34.111Z' +last_edited: '2024-09-26T06:54:19.563Z' next: content/docs/reference/types/rich-text.mdx previous: content/docs/reference/types/reference.mdx --- ## `object` Type +The `object` field is a dynamic field type that creates a nested page in the CMS with the data it contains. + +This can be used to create repeated data structures, group related data in the CMS and/or give users the option to choose between a set of templates. + ```ts type ObjectField = { label: string @@ -35,6 +39,22 @@ type ObjectField = { } ``` +## Usage + +Ultimately there are 3 ways to configure this type... + +* With `list` set to `false`, the `fields` array can be used to wrap some data – this appears in the editor as a nested page. This can be used to organise the CMS, such as grouping options together, as in the gif below. + +![](https://res.cloudinary.com/forestry-demo/image/upload/v1727331124/tina-io/docs/Sep-26-2024_16-05-37_d2ol8w.gif) + +* With `list` set to `true`, the `fields` array contains the data structure to be repeated – this appears in the editor as above, but grouped as a list. + +![](https://res.cloudinary.com/forestry-demo/image/upload/v1727331115/tina-io/docs/Sep-26-2024_16-03-00_f3ogev.gif) + +* With `list` set to `true`, and using `templates` as opposed to `fields` the user can select between associated templates – this appears as above, but pressing the `+` gives you the option to choose between templates. + +![](https://res.cloudinary.com/forestry-demo/image/upload/v1727331134/tina-io/docs/Sep-26-2024_16-07-02_zv5uth.gif) + ## Examples Tina will generate the appropriate component depending on the configuration provided. @@ -108,9 +128,7 @@ Tina will generate the appropriate component depending on the configuration prov ### Using list object as a wrapper for other types -Number, boolean, datetime and rich-text field types can be used in this way to add list options to the TinaCMS editor. - -Reference field types can be used in this way to create a list of references. +Number, boolean, datetime, reference and rich-text field types can be used as the sole field of an object to create a list of one of those types. ```javascript {