© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
12 replies
ico

How to dynamically generate Field schemas in Filament v3

I have 2 sections

1st the user will pick a item from a select
After it is picked the 2nd section needs to be visible and be filled with many text inputs based on what the user has picked from the select.
But when i try to generate the schema on the spot it gives me a error
Property type not supported in Livewire for property: [{}]
Property type not supported in Livewire for property: [{}]


Code:
Section::make('AQL Report Form')
    ->schema([
        TextInput::make('limitCardNumber')
            ->label('Limit Card')
            ->disabled(true),
        TextInput::make('orderQuantity')
            ->label('Order Quantity')
            ->disabled(true),
        Select::make('stageId')
            ->options($this->stages)
            ->label('Stage')
            ->afterStateUpdated(function (Set $set, Get $get) {
                $this->updateDefects($this->stageId);
            })
            // This is needed for the stateUpdated method to work
            ->reactive(),
    ])
    ->columns(3),
Section::make('Defect List')
    ->schema(function () {
        return $this->defectListSchema;
    })
    ->columns(3)
    ->hidden(function () {
        return $this->hideDefectList;
    })
    ->reactive(),
Section::make('AQL Report Form')
    ->schema([
        TextInput::make('limitCardNumber')
            ->label('Limit Card')
            ->disabled(true),
        TextInput::make('orderQuantity')
            ->label('Order Quantity')
            ->disabled(true),
        Select::make('stageId')
            ->options($this->stages)
            ->label('Stage')
            ->afterStateUpdated(function (Set $set, Get $get) {
                $this->updateDefects($this->stageId);
            })
            // This is needed for the stateUpdated method to work
            ->reactive(),
    ])
    ->columns(3),
Section::make('Defect List')
    ->schema(function () {
        return $this->defectListSchema;
    })
    ->columns(3)
    ->hidden(function () {
        return $this->hideDefectList;
    })
    ->reactive(),


The
updateDefects()
updateDefects()
triggers a
generateDefectListSchema()
generateDefectListSchema()
method for generating the 2nd section schema

generateDefectListSchema()
generateDefectListSchema()


$schema = [];
$defectCategories = DefectCategory::get()->pluck('category', 'id')->toArray();
if (is_null($this->defectsByCategory)) {
    return $schema;
}
foreach ($this->defectsByCategory as $category => $defects) {
    $sectionSchema = [];
    foreach ($defects as $defect) {
        $sectionSchema = array_merge($sectionSchema, [
            TextInput::make('defectName')->label($defect['name'])->disabled(true),
        ]);
    }
    $schema = array_merge($schema, [
        Section::make($defectCategories[$category])
            ->schema($sectionSchema),
    ]);
}
return $schema;
$schema = [];
$defectCategories = DefectCategory::get()->pluck('category', 'id')->toArray();
if (is_null($this->defectsByCategory)) {
    return $schema;
}
foreach ($this->defectsByCategory as $category => $defects) {
    $sectionSchema = [];
    foreach ($defects as $defect) {
        $sectionSchema = array_merge($sectionSchema, [
            TextInput::make('defectName')->label($defect['name'])->disabled(true),
        ]);
    }
    $schema = array_merge($schema, [
        Section::make($defectCategories[$category])
            ->schema($sectionSchema),
    ]);
}
return $schema;

The
$schema
$schema
is filled correctly i can see the result when i
dd($schema)
dd($schema)
Solution
changed it
protected
protected
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to generate fields dynamically?
FilamentFFilament / ❓┊help
3y ago
How to filament table in filament form in v3?
FilamentFFilament / ❓┊help
3y ago
Field dependency in Filament v3 seems to be busted
FilamentFFilament / ❓┊help
3y ago
How to make logic `afterStateUpdateJs()` in filament v3?
FilamentFFilament / ❓┊help
9mo ago