OwenMelbz / nova-radio-field

Provides a radio field for laravel nova with ability to toggle field visibility.
34 stars 31 forks source link

[FEATURE REQUEST] Add ability to set labels as html #25

Open ragingdave opened 3 years ago

ragingdave commented 3 years ago

In order to be able to further customize the radio labels, it might be nice to be able to set the label as html. This would enable bolding or colors or anything else. I'm not saying this package would have to account for style mistakes as a result of enabling html, just to enable html support. This would be akin to how the Text field can display as html in nova already.

OwenMelbz commented 3 years ago

@ragingdave Are you able to modify and recompile this yourself as a test?

I don't have access to Nova anymore so cannot easily check much.

https://github.com/OwenMelbz/nova-radio-field/blob/28bb17d59af3c5ab944e78db7c0ae974ce42c903/resources/js/components/FormField.vue#L9

If you change this to

<span class="mlbz-radio-label" v-html="getOptionLabel(option)"></span>

Then compile it, you can then try passing in a label with HTML and see if it works.

Otherwise you could always try use CSS to target, e.g. the label generates a unique "for" e.g.

<label for="accountType_premium">
<label for="accountType_basic">
<label for="accountType_trial">

You can then add a selector like... .mlbz-radio-container label[for="accountType_premium"] span etc to style them with just CSS?