mirror of
https://github.com/zhigang1992/firecms.git
synced 2026-06-14 09:38:59 +08:00
53 lines
1.8 KiB
Markdown
53 lines
1.8 KiB
Markdown
---
|
|
id: array
|
|
title: Array
|
|
sidebar_label: Array
|
|
---
|
|
|
|
## `of`
|
|
|
|
The property of this array.
|
|
|
|
You can specify any property (except another Array property, since
|
|
Firestore does not support it)
|
|
You can leave this field empty only if you are providing a custom field or
|
|
provide a `oneOf` field otherwise an error will be thrown.
|
|
|
|
|
|
## `oneOf`
|
|
|
|
Use this field if you would like to have an array of properties.
|
|
It is useful if you need to have values of different types in the same
|
|
array.
|
|
Each entry of the array is an object with the shape:
|
|
```
|
|
{ type: "YOUR_TYPE", value: "YOUR_VALUE"}
|
|
```
|
|
Note that you can use any property so `value` can take any value (strings,
|
|
numbers, array, objects...)
|
|
You can customise the `type` and `value` fields to suit your needs.
|
|
|
|
An example use case for this feature may be a blog entry, where you have
|
|
images and text blocks using markdown.
|
|
|
|
## `validation`
|
|
|
|
* `required` Should this field be compulsory.
|
|
* `requiredMessage` Message to be displayed as a validation error.
|
|
* `min` Set the minimum length allowed.
|
|
* `max` Set the maximum length allowed.
|
|
|
|
---
|
|
|
|
Based on your configuration the form field widgets that are created are:
|
|
- [`ArrayDefaultField`](api/functions/arraydefaultfield.md) generic array field that allows reordering and renders
|
|
the child property as nodes.
|
|
- [`StorageUploadField`](api/functions/storageuploadfield.md) if the `of` property is a `string` with storage configuration.
|
|
- [`ArrayEnumSelect`](api/functions/arrayenumselect.md) if the `of` property is a `string` with an enum configuration.
|
|
- [`ArrayOfReferencesField`](api/functions/arrayofreferencesfield.md) if the `of` property is a `reference`
|
|
- [`ArrayOneOfField`](api/functions/arrayoneoffield.md) if the `oneOf` property is specified
|
|
|
|
Links:
|
|
- [API](api/interfaces/arrayproperty.md)
|
|
|