How can I render form builder components in a custom view?

Hi guys, is there documentation on how to use the form builder on a custom view? I have my form schema defined, what's the convention to render the fields on my custom view page? My resource defines a custom page:
public static function getPages(): array
{
return [
...
'view' => Pages\EventCheckin::route('/{record}'),
];
}
public static function getPages(): array
{
return [
...
'view' => Pages\EventCheckin::route('/{record}'),
];
}
I defined a custom view on this page, so I can use a 3rd party datatable library on it:
protected static string $view = 'filament.resources.event-resource.pages.event-checkin';
protected static string $view = 'filament.resources.event-resource.pages.event-checkin';
I also defined a form schema:
protected function getFormSchema(): array
{
return [
TextInput::make('name_search')->required(),
... other fields
];
}
protected function getFormSchema(): array
{
return [
TextInput::make('name_search')->required(),
... other fields
];
}
My question is, how can I render those form fields on my custom view page? I couldn't find what convention (eg <x-filament-.... />) to use on the docs
Solution:
The general recommendation is to create a custom Livewire component, add the form(s) to it, and then add the component to your custom page :
@livewire('my-custom-component')
@livewire('my-custom-component')
...
Jump to solution
4 Replies
hugh_jazz99
hugh_jazz99OP17mo ago
The page looks like this. The 'name search' field above the table is just raw html, not actually a filament component. I want to render the actual field component that I defined on getFormSchema
Solution
Patrick Boivin
Patrick Boivin17mo ago
The general recommendation is to create a custom Livewire component, add the form(s) to it, and then add the component to your custom page :
@livewire('my-custom-component')
@livewire('my-custom-component')
Patrick Boivin
Patrick Boivin17mo ago
When you create the Livewire component, you can follow from here in the docs : https://filamentphp.com/docs/2.x/forms/getting-started#preparing-your-livewire-component
hugh_jazz99
hugh_jazz99OP17mo ago
Perfect this is what I needed, thank you!
Want results from more Discord servers?
Add your server