© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
11 replies
Jon Mason

Custom View field doesn't recognize css changes???

Really confused as to why my custom view field won't recognize any CSS changes. I was trying to add padding originally and couldn't figure out why it wasn't changing at all.. So I removed everything to where I literally just have
<div class="bg-red-700">Text</div>
<div class="bg-red-700">Text</div>
in my view, and it doesn't show the background. Why would that be?

here's my class:
class ContactCard extends Component
{
    protected string $view = 'filament.forms.components.contact-card';

    protected array $items = [];

    public static function make(): static
    {
        return new static();
    }

    public function items(array $items): static
    {
        $this->items = $items;

        return $this;
    }

    public function getItems(): array
    {
        return $this->items;
    }
}
class ContactCard extends Component
{
    protected string $view = 'filament.forms.components.contact-card';

    protected array $items = [];

    public static function make(): static
    {
        return new static();
    }

    public function items(array $items): static
    {
        $this->items = $items;

        return $this;
    }

    public function getItems(): array
    {
        return $this->items;
    }
}


and my view file:
@foreach ($getItems() as $item)
    
    <div class="bg-red-700">Text</div>

@endforeach
@foreach ($getItems() as $item)
    
    <div class="bg-red-700">Text</div>

@endforeach


and within my form:
 Tab::make('Contacts')
                        ->schema([

                            ContactCard::make('contacts')->items(User::all()->pluck('first_name', 'id')->toArray()),

                        ]),
 Tab::make('Contacts')
                        ->schema([

                            ContactCard::make('contacts')->items(User::all()->pluck('first_name', 'id')->toArray()),

                        ]),
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Custom Field CSS
FilamentFFilament / ❓┊help
2y ago
Label on form field, custom view
FilamentFFilament / ❓┊help
3y ago
Datepicker view changes
FilamentFFilament / ❓┊help
14mo ago
Custom Field - load data for the view
FilamentFFilament / ❓┊help
3y ago