Fields

Array Field

The array field creates a repeatable list of sub-fields. Each row contains the same set of fields, and users can add, remove, and reorder rows in the admin editor. Data is stored as an array of objects on the parent document.

Config Options

OptionTypeDefaultDescription
fieldsRecord<string, Field>requiredSub-field definitions for each row
minRowsnumber—Minimum number of rows
maxRowsnumber—Maximum number of rows
rowLabelstring | function | object—Label displayed on each collapsed row
collapsiblebooleanfalseWhether rows can be collapsed
collapsedbooleanfalseWhether rows start collapsed
requiredbooleanfalseWhether the array must have at least one row

Example Usage

import { f } from "vextro";

const fields = {
  features: f.array({
    fields: {
      title: f.text({ required: true }),
      description: f.textarea(),
      icon: f.text(),
    },
    minRows: 1,
    maxRows: 10,
    rowLabel: "title",
  }),
};

Row Labels

Row labels control the text displayed on each collapsed row.

  • Field name -- display the value of a sub-field: rowLabel: "title"
  • Template string -- interpolate multiple fields: rowLabel: "{label} → {url}"
  • Function -- full control: rowLabel: (row, i) => \${i + 1}. ${row.name}``
  • Object config -- with fallbacks:
rowLabel: { field: "title", fallback: "New Step", showIndex: true }

Admin Options

All common admin options are supported including label, description, condition, sidebar, sidebarSection, listColumn, and viewTransition. See Overview for details.

Stored Data

{
  "features": [
    { "title": "Fast", "description": "Blazing speed", "icon": "bolt" },
    { "title": "Secure", "description": "Encrypted", "icon": "lock" }
  ]
}
Previous
Image
Next
Group