feat: adds docs example

This commit is contained in:
Jarrod Flesch
2022-11-15 12:37:47 -05:00
parent b74ea218ca
commit 2bf0fffa0d
2 changed files with 24 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ In addition to the default [field admin config](/docs/fields/overview#admin-conf
| Option | Description |
| ---------------------- | ------------------------------- |
| **`initCollapsed`** | Set the initial collapsed state |
| **`components.RowLabel`** | React component to be rendered as the label on the array row. [More](/admin/components/#field-component) |
### Example
@@ -68,6 +69,10 @@ const ExampleCollection: CollectionConfig = {
plural: 'Slides',
},
fields: [ // required
{
name: 'title',
type: 'text',
}
{
name: 'image',
type: 'upload',
@@ -78,7 +83,14 @@ const ExampleCollection: CollectionConfig = {
name: 'caption',
type: 'text',
}
]
],
admin: {
components: {
RowLabel: ({ data, fallback }) => {
return data?.title || fallback;
},
},
},
}
]
};