Create FilamentPHP v4 form schemas with field types, validation rules, sections, and relationship fields
Generates FilamentPHP v4 form schemas from natural language descriptions. Use it to quickly create forms with proper field types, validation rules, and layout components for resources, actions, or standalone forms.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install post-development@mwguerra-marketplace<description> [--resource ResourceName] [--for model|action|standalone]Create a FilamentPHP v4 form schema with appropriate field types, validation rules, and layout components.
# Describe the form you need
/filament:form "user registration with name, email, password, and profile picture"
# For a specific resource
/filament:form "product with name, price, description, category, and images" --resource ProductResource
# For a modal action
/filament:form "send email with subject, recipient, and body" --for action
Before generating, read the forms documentation:
/home/mwguerra/projects/mwguerra/claude-code-plugins/filament-specialist/skills/filament-docs/references/forms/Parse the description to identify:
| Requirement | Filament Field |
|---|---|
| Text/string | TextInput |
| Long text | Textarea or RichEditor |
| Number | TextInput::numeric() |
| TextInput::email() | |
| Password | TextInput::password() |
| Date | DatePicker |
| DateTime | DateTimePicker |
| Boolean | Toggle or Checkbox |
| Selection | Select or Radio |
| Multiple selection | CheckboxList or Select::multiple() |
| File | FileUpload |
| Image | FileUpload::image() |
| Relationship (one) | Select::relationship() |
| Relationship (many) | CheckboxList::relationship() |
| Nested items | Repeater |
| Flexible content | Builder |
Create the form schema with:
Complete form schema code with:
For /filament:form "user registration with name, email, password, and profile picture":
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\FileUpload;
use Illuminate\Support\Facades\Hash;
public static function form(Form $form): Form
{
return $form
->schema([
Section::make('Account Information')
->description('Enter the user\'s basic account details')
->schema([
Grid::make(2)
->schema([
TextInput::make('name')
->label('Full Name')
->required()
->maxLength(255)
->placeholder('John Doe'),
TextInput::make('email')
->label('Email Address')
->email()
->required()
->unique(ignoreRecord: true)
->placeholder('john@example.com'),
]),
Grid::make(2)
->schema([
TextInput::make('password')
->label('Password')
->password()
->required(fn (string $operation): bool => $operation === 'create')
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
->dehydrated(fn (?string $state): bool => filled($state))
->minLength(8)
->confirmed(),
TextInput::make('password_confirmation')
->label('Confirm Password')
->password()
->required(fn (string $operation): bool => $operation === 'create')
->dehydrated(false),
]),
]),
Section::make('Profile')
->description('Optional profile information')
->schema([
FileUpload::make('avatar')
->label('Profile Picture')
->image()
->imageEditor()
->circleCropper()
->disk('public')
->directory('avatars')
->visibility('public')
->maxSize(2048)
->helperText('Upload a profile picture (max 2MB)'),
])
->collapsible(),
]);
}
TextInput::make('title')
->required()
->maxLength(255)
->placeholder('Enter title...')
->helperText('This will be displayed as the main heading');
TextInput::make('price')
->numeric()
->prefix('$')
->minValue(0)
->step(0.01);
TextInput::make('email')
->email()
->unique(table: User::class, ignoreRecord: true);
Select::make('status')
->options([
'draft' => 'Draft',
'published' => 'Published',
])
->default('draft')
->required();
Select::make('category_id')
->relationship('category', 'name')
->searchable()
->preload()
->createOptionForm([
TextInput::make('name')->required(),
]);
Toggle::make('is_active')
->label('Active')
->default(true)
->onColor('success')
->offColor('danger');
Checkbox::make('terms')
->label('I agree to the terms')
->required()
->accepted();
DatePicker::make('birth_date')
->native(false)
->displayFormat('d/m/Y')
->maxDate(now());
DateTimePicker::make('published_at')
->native(false)
->seconds(false);
FileUpload::make('document')
->disk('public')
->directory('documents')
->acceptedFileTypes(['application/pdf'])
->maxSize(10240);
FileUpload::make('images')
->image()
->multiple()
->reorderable()
->directory('gallery');
Repeater::make('items')
->relationship()
->schema([
TextInput::make('name')->required(),
TextInput::make('quantity')->numeric()->required(),
])
->columns(2)
->addActionLabel('Add Item');
Builder::make('content')
->blocks([
Builder\Block::make('paragraph')
->schema([
RichEditor::make('content'),
]),
Builder\Block::make('image')
->schema([
FileUpload::make('url')->image(),
TextInput::make('alt'),
]),
]);