Skip to content

EnformaRepeatableTable

The schema for repeatable table components is almost identical to the component's props.

Props

PropTypeDescription
nameStringThe field name for the array (required)
subfieldsObjectRecord of field definitions to render as table columns
minNumberMinimum number of items (default: 0)
maxNumberMaximum number of items (default: Infinity)
defaultValueAnyDefault value for new items when added
validateOnAddBooleanWhether to validate when adding a new item (default: true)
validateOnRemoveBooleanWhether to validate when removing an item (default: false)
addButtonComponentCustom add button component
removeButtonComponentCustom remove button component
moveUpButtonComponentCustom move up button component
moveDownButtonComponentCustom move down button component
allowAddBooleanWhether to allow adding new items (default: true)
allowRemoveBooleanWhether to allow removing items (default: true)
allowSortBooleanWhether to allow sorting items (default: true)

Subfields Definition

Each field in the subfields object should be a valid field configuration that includes at minimum:

js
{
  inputComponent: 'text',
  label: 'Product Name', // The column header
  // ...other field props as needed
}

All properties that can be passed to EnformaField can be used in these subfield definitions.

Slots

The component only exposes the #default slot which you can use to organize the layout of the component if the subfields props is not enough or you don't want to use it.

Styling

The component uses the following props from the configuration:

  • pt.repeatable_table.wrapper - The outer wrapper div
  • pt.repeatable_table.table - The table element
  • pt.repeatable_table.th - The table header cells
  • pt.repeatable_table.td - The table data cells
  • pt.repeatable_table.actionsTd - The cell containing action buttons
  • pt.repeatable_table.itemActions - The container for item action buttons
  • pt.repeatable_table.actions - The container for the add button

Released under the MIT License