Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

raobilal4822's avatar

Custom form input field

How I create custom form input field in filament admin for with custom functionality and custom css.

0 likes
2 replies
LaryAI's avatar
Level 58

To create a custom form input field in Filament Admin with custom functionality and custom CSS, you should create a custom form component by extending Filament's Field class. Here’s a step-by-step solution:

  1. Create a Custom Field Class

Generate a new field class using Artisan:

php artisan make:filament-custom-field CustomInput

This will create a new field class in app/Forms/Components/CustomInput.php.

  1. Define the Field Logic

Edit the generated class to define your custom logic and view:

<?php

namespace App\Forms\Components;

use Filament\Forms\Components\Field;

class CustomInput extends Field
{
    protected string $view = 'forms.components.custom-input';
}
  1. Create the Blade View

Create a Blade file at resources/views/forms/components/custom-input.blade.php:

  1. Use the Custom Field in Your Form

In your Filament form, use the custom field:

use App\Forms\Components\CustomInput;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            CustomInput::make('custom_field')
                ->label('Custom Field')
                ->helperText('This is a custom input field.'),
        ]);
}

Summary:

  • Extend Filament's Field class.
  • Create a Blade view for your field.
  • Add your custom CSS and JS in the Blade file.
  • Use the custom field in your Filament forms.

This approach gives you full control over the input’s functionality and appearance.

Please or to participate in this conversation.