Source: ryangjchandler.co.uk

Building a custom Filament view component
Out of the box, Filament provides a tonne of components that you can use in your application. Let's look at how I built a DescriptionList component for one of my own projects.

class DescriptionList extends Component { protected string $view = 'filament.forms.components.description-list'; protected array | Closure $items = []; public function items(array | Closure $items): static { $this->items = $items; return $this; }}

protected function getFormSchema(): array { return [ DescriptionList::make('overview') ->items(function (Model $record, Closure $get) { $items = [ 'Name' => $record->name, 'Email' => $record->email, ]; if (!!

class DescriptionList extends Component { public function getItems(): array { return $this->evaluate($this->items); }}
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners