How to create form with Filament styles outside the panel?

Hi, guys, I am trying to create my first Filament form outside of panel, that I have created. I want to send email with signed URL, that will redirect user to fill some form that is on center of blank page styled like Filament panel. I am not sure how to do that easily.
5 Replies
toeknee
toeknee2w ago
Yep That's right as per the docs
Julien B. (aka yebor974)
I wrote an article on using Filament outside of panels if that can help you https://filamentmastery.com/articles/guide-to-using-filament-components-in-public-facing-pages You can next use form in a livewire component
Filament Mastery
Guide to using Filament Components in public-facing pages - Filamen...
Learn how to integrate Filament components into your public-facing pages with this step-by-step guide.
Trauma Zombie
Trauma ZombieOP2w ago
I try it like this:
class RegistrationForm extends SimplePage implements HasForms
{
use InteractsWithForms;

protected static string $view = 'filament.pages.registration-form';

public ?array $data = [];

public function mount(): void
{
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('first_name')
->required()
->maxLength(255),

TextInput::make('last_name')
->required()
->maxLength(255),
])
->columns(6)
->statePath('data');
}

public function create(): void
{
dd($this->form->getState());
}
}
class RegistrationForm extends SimplePage implements HasForms
{
use InteractsWithForms;

protected static string $view = 'filament.pages.registration-form';

public ?array $data = [];

public function mount(): void
{
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('first_name')
->required()
->maxLength(255),

TextInput::make('last_name')
->required()
->maxLength(255),
])
->columns(6)
->statePath('data');
}

public function create(): void
{
dd($this->form->getState());
}
}
Is it good approach?
toeknee
toeknee2w ago
That is sure! getState validates too so perfect.

Did you find this page helpful?