© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
gladjanus43

Custom card Radio Button form field

Hi,

I have build a custom form field for displaying the radio button as a card with an image. Everything is working fine but I would like to add a border to the checked radio button.

I can't really figure out how to do it in the custom view. I know tailwind has some cool peer-checked options but I cannot get it working...

Does someone have a good idea how to solve this?
Thanks!
Screenshot_2023-09-20_at_18.31.18.png
Solution
For others:
In your blade file you need to add this to your input field. So the state gets updated every time the user changes the input. This directly sends a request to the server everytime if ->live() is added.
<input {{ $applyStateBindingModifiers('wire:model') }}="{{ $getStatePath() }}" />

Also make sure to make the component ->live() in your resource.

Then you can add classes dynamically by checking $getState() and apply classes to it.
@if ($getState() == $value) border-2 border-green-500 @endif
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Custom form field
FilamentFFilament / ❓┊help
2y ago
Custom Form Field
FilamentFFilament / ❓┊help
2y ago
Custom field button color
FilamentFFilament / ❓┊help
16mo ago
Custom MoneyInput form field
FilamentFFilament / ❓┊help
2y ago