Custom field button color
I create a custom form field to record voice. How to change <x-filament::button> color when i click on it. This is my button code:
Thanks!
9 Replies
something like this:
:color="isRecording ? 'primary' : 'secondary'"
Thanks @Lara Zeus, but it doesn't works. It throws Undefined constant "isRecording" error when i add color condition (isRecording works fine on "x-on:click and x-text")
what is
isRecording
? is it a php thing or js? 🙂
you can add custom classes using alpine js:
:class="open ? '' : 'hidden'"
isRecording its a js variable. I share all custom field here
maybe
@Leandro Ferreira it works!!! I don't understand the code but it works 😅
These CSS variables define the button colors. I set them based on the
isRecording
value..
Maybe this can be better, but I think this works 🙂Yes, it works… thanks!! 😉