How to Achieve Radio Option Styling

Hello Community, Im trying to add styling to my radio options, such as border and padding
$fields[] = Forms\Components\Radio::make("scores.{$subcategory->id}")
->label($subcategory->name)
->inline()
->options($scoreOptions)
->extraAttributes([
'class' => 'border border-gray-300 rounded-lg px-4 py-2 cursor-pointer hover:border-gray-500 focus:border-blue-500 transition-all duration-200',
])
->default(null) // Default to "Skipped"
->required();
$fields[] = Forms\Components\Radio::make("scores.{$subcategory->id}")
->label($subcategory->name)
->inline()
->options($scoreOptions)
->extraAttributes([
'class' => 'border border-gray-300 rounded-lg px-4 py-2 cursor-pointer hover:border-gray-500 focus:border-blue-500 transition-all duration-200',
])
->default(null) // Default to "Skipped"
->required();
when i do this, this only add the style to the container of all radio instead of each indivitual radio
No description
Solution:
That will just apply to the container. extraInputAttributes is like what you want......
Jump to solution
5 Replies
Solution
toeknee
toeknee3w ago
That will just apply to the container. extraInputAttributes is like what you want...
toeknee
toeknee3w ago
also ensure those classes exist in the rendering engine
waterflai
waterflaiOP3w ago
is there a way to achieve the radio option style ?
toeknee
toeknee3w ago
As I said apply it to the ->extraInputAttributes([]) not ->extraAttributes([])
waterflai
waterflaiOP3w ago
thank you !

Did you find this page helpful?