Matrix / Grid Field

Collect structured responses using a grid of rows and columns, useful for rating multiple items or comparing options.

Overview

The matrix field type creates a grid layout where users select options for multiple items in one question. It works well for satisfaction surveys, skill assessments, and anywhere you need the same response type across several items. Matrix fields are validated by the SelectFieldValidator.

Basic Usage (Single Selection)

Use addMatrix() to create a matrix field. Define the rows (items to rate) in settings and the columns (rating options) via the options() method.

app/Actions/CreateSurveyForm.php

Multiple Selection Matrix

Set allow_multiple to true to let users pick multiple options per row. This switches the inputs from radio buttons to checkboxes.

app/Actions/CreateAssessmentForm.php

Available Settings

SettingTypeDefaultDescription
rowsarray[]Array of row labels. Each row represents an item to be rated.
columnsarraynullArray of column labels. If not set, uses the field's options array.
allow_multiplebooleanfalseAllow multiple selections per row (checkboxes) instead of single selection (radio buttons).

Validation

The SelectFieldValidator checks:

  • All required rows have at least one selection (if the field is required)
  • Selected values match the defined options
  • Multiple selections per row are only allowed when allow_multiple is true
  • Response structure is valid (object with row keys and value/array values)

Common Use Cases

  • Customer satisfaction surveys (rating multiple aspects of service)
  • Employee performance evaluations
  • Product feature comparisons
  • Skills or competency assessments
  • Multi-item Likert scales
  • Priority ranking of features or topics

Response Data Structure

Matrix submissions are stored as an object where each key is a row identifier and the value is the selected option(s):

{
  "Customer Support": "Satisfied",
  "Product Quality": "Very Satisfied",
  "Delivery Speed": "Neutral",
  "Value for Money": "Satisfied"
}

For multiple selection matrices, each value is an array:

{
  "JavaScript": ["Intermediate", "Advanced"],
  "PHP": ["Beginner"],
  "Python": ["Advanced", "Expert"],
  "SQL": ["Intermediate"]
}