Skip to main content
← Back to Table of Contents

Summary

A specialized grid input based on Filament’s Repeater, optimized for bulk data entry across fixed rows and columns. Unlike a standard repeater, FlexMatrixTable is non-addable and non-deletable, providing a stable spreadsheet-like interface for complex configurations.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\FlexMatrixTable
State typearray<string, array<string, mixed>>
Model cast'matrix_data' => 'array'
FieldTypeflex-matrix-table
Playgroundflex-matrix-table slug in Flex Fields playground
ExtendsFilament\Forms\Components\Repeater

Basic usage

Permission Matrix

use Bjanczak\FilamentFlexFields\Filament\Forms\Components\FlexMatrixTable;
use Filament\Forms\Components\Toggle;

FlexMatrixTable::make('permissions')
    ->rows([
        'users' => 'User Management',
        'posts' => 'Blog Posts',
        'settings' => 'System Settings',
    ])
    ->schema([
        Toggle::make('view')->label('View'),
        Toggle::make('create')->label('Create'),
        Toggle::make('edit')->label('Edit'),
        Toggle::make('delete')->label('Delete'),
    ]);

Custom Column Widths

FlexMatrixTable::make('pricing')
    ->rows(['basic' => 'Basic', 'pro' => 'Pro'])
    ->schema([
        TextInput::make('price')->numeric()->prefix('$'),
        TextInput::make('limit')->numeric(),
    ])
    ->columnWidths([
        'price' => '150px',
        'limit' => '100px',
    ]);

State & validation

Stored value

The state is an associative array where keys are row IDs and values are arrays of field data from the schema().
[
    'users' => [
        'view' => true,
        'create' => false,
        'edit' => true,
    ],
    'posts' => [
        'view' => true,
        'create' => true,
        'edit' => true,
    ],
]

Fixed Structure

By default, FlexMatrixTable disables addable(), deletable(), and reorderable(). This ensures the matrix always matches your defined rows().

Configuration API

All methods accept Closure unless noted.
MethodTypeDefaultDescription
rows(array|Closure $rows)Setup[]Row keys => labels
columnWidths(array|Closure $w)Setup[]Field name => CSS width
size(string|Closure $size)Setup'md'sm, md, lg
rounding(string|Closure $round)SetupconfigBorder radius token
schema(array|Closure $schema)SetupFields to show in each row

Real-world examples

Feature Availability Matrix

FlexMatrixTable::make('features')
    ->label('Plan Features')
    ->rows([
        'api' => ['label' => 'API Access', 'desc' => 'REST & GraphQL'],
        'sso' => ['label' => 'Single Sign-On', 'desc' => 'SAML & OAuth'],
        'support' => ['label' => 'Priority Support', 'desc' => '24/7 coverage'],
    ])
    ->schema([
        Checkbox::make('starter')->label('Starter'),
        Checkbox::make('business')->label('Business'),
        Checkbox::make('enterprise')->label('Enterprise'),
    ])
    ->columnWidths([
        'starter' => '100px',
        'business' => '100px',
        'enterprise' => '100px',
    ]);

Playground

/admin/flex-fields-playground/flex-matrix-table See Playground for setup.
ComponentWhen to use instead
MatrixChoiceFieldSimple radio/checkbox grids without custom schemas
RepeaterWhen users need to add/remove rows dynamically
ItemCardGroupVisual card-based bulk selection

CSS classes (reference)

ClassRole
fff-matrix-choiceRoot wrapper (shared with MatrixChoice)
fff-matrix-choice--{sm|md|lg}Size variant
fff-matrix-choice__headerTable header row
fff-matrix-choice__rowIndividual data row
fff-matrix-choice__cellData cell
fff-matrix-choice__labelRow label wrapper
fff-matrix-choice__descriptionRow description text