Field Collection Component
Purpose
The field-collection component edits an array field inside a form. It renders one template per array item and supports add, remove, remove-all, drag-and-drop reorder, item defaults, list/grid/accordion item layouts, and grouped collections.
Use it for repeated sub-records such as line items, contacts, business hours, accessorial rows, or task lists.
Source update
Frontend commit 8180273 added group-level grid controls for grouped collections:
groupColscontrols how many groups render per row.groupSpacingcontrols Material UI grid spacing between group columns.
These props only affect groupMode: true; item layout inside each group still uses layout, cols, and spacing.
Props
fieldName(string, required): Form array field binding.itemTemplate(component or component array, required): Template rendered for each item.itemType(object | string | number | boolean | auto): Type of item to create and edit. Defaults toobject.options.allowAdd(boolean): Show add button. Defaults totrue.options.allowRemove(boolean): Show remove buttons. Defaults totrue.options.allowRemoveAll(boolean): Show remove-all button. Defaults tofalse.options.allowReorder(boolean): Enable drag-and-drop reorder. Defaults totrue.options.minItems/options.maxItems(number): Minimum and maximum item counts.addButton.label,addButton.icon,addButton.variant,addButton.position: Add button customization.removeButton.label,removeButton.icon,removeButton.variant: Remove button customization.defaultItem(any): Default values for newly added items.layout(list | grid | accordion): Item layout mode. Defaults tolist.cols(number): Item grid columns whenlayout: grid.spacing(number): Spacing between items.groupMode(boolean): Enable grouping.groupBy(string): Item field used as the group key.groups(array): Group definitions withkey,label, and optionalicon.groupTemplate(component): Optional custom group header template.groupCols(number or breakpoint object): Number of group columns. Example:2or{ xs: 1, md: 2, lg: 4 }. Defaults to1.groupSpacing(number): Spacing between group columns. Defaults to0.showIndex(boolean): Show item index numbers.showDragHandle(boolean): Show drag handles.showDivider(boolean): Show dividers between list items.containerClass/itemClass(string): CSS class hooks.itemTitle(string): Field name or template for accordion item title.defaultExpanded(boolean): Expand accordion items by default.label(localized string): Section label above the collection.
Grouped multi-column example
component: field-collection
name: businessHours
props:
fieldName: businessHours
groupMode: true
groupBy: dayOfWeek
groupCols:
xs: 1
md: 2
lg: 4
groupSpacing: 2
groups:
- key: 1
label: { en-US: Monday }
- key: 2
label: { en-US: Tuesday }
- key: 3
label: { en-US: Wednesday }
- key: 4
label: { en-US: Thursday }
- key: 5
label: { en-US: Friday }
- key: 6
label: { en-US: Saturday }
- key: 0
label: { en-US: Sunday }
options:
allowAdd: true
allowRemove: true
allowReorder: true
defaultItem:
startTime: "09:00:00"
endTime: "17:00:00"
layout: accordion
itemTemplate:
component: layout
props:
cols: 2
spacing: 2
children:
- component: field
name: startTime
props:
type: time
label: { en-US: Start }
- component: field
name: endTime
props:
type: time
label: { en-US: End }
Behavior notes
- In grouped mode, the component renders each configured group and filters items by
groupBy. - Adding an item from a group automatically assigns that group's key to the
groupByfield. groupColsmaps to a 12-column Material UI grid (groupCols: 3renders each group atxs: 4).- Responsive
groupColsvalues are converted per breakpoint, e.g.{ md: 2 }becomesmd: 6grid width.