Search code examples
laravellaravel-filamentfilamentphp

How to customize width of a modal form created by createOptionForm method in filament php


Below is my code for creating a modal form. How can I customize its width? I'd like to be a bit smaller

->createOptionForm([
                        Forms\Components\TextInput::make('name')
                            ->required()
                            ->maxLength(255)
                            ->unique(modifyRuleUsing: function (Unique $rule) {
                                return $rule->where('user_id', auth()->id());
                            }),
                        Forms\Components\TextInput::make('stock')
                            ->required()
                            ->integer()
                            ->minValue(1)
                            ->maxLength(255),
                    ])

Solution

  • ->createOptionAction(fn ($action) => $action->modalWidth('sm'))
    

    Reference: https://github.com/filamentphp/filament/pull/12352#issuecomment-2058382669