How to style the inline label in Simple Form?

Multi tool use
Multi tool use


How to style the inline label in Simple Form?



I have a Simple Form checkbox which uses both a regular field label and an inline label:


<%= f.input :remove_default_template,
label: 'Advanced Option',
inline_label: "Remove Header, Footer, and Department Name"
%>



And I need to add styling to the inline label. How can I do this? I would expect something following this pattern to work:


<%= f.input :remove_default_template,
label: 'Advanced Option',
inline_label: "Remove Header, Footer, and Department Name",
inline_label_html:
input_html: {class: "input_class"}, # THIS works
wrapper_html: {class: "wrapper_class"}, # THIS works
label_html: {class: "label_class"}, # THIS works
inline_label_html: {class: "inline_label_class"} # THIS DOES NOT WORK!!!
%>



but the final line doesn't work:


inline_label_html: {class: "inline_label_class"}



Since Simple Form doesn't seem to support this option (at least under the name I expected, nor anything else that I could find), how can I accomplish the same goal?




1 Answer
1



You might want to have a hint, not an inline label.



Then you can write a wrapper, which allows doing something like this


<%= f.input :subdomain, input_wrapper_html: { class: 'col-sm-4' } %>



And then your hints will be inline.



Please check here https://github.com/plataformatec/simple_form/issues/1035





interesting... does a hint for a checkbox look just like an inline label? The example you linked to deals with a text field, not a checkbox, so I'm not sure how this will work
– iconoclast
Jul 4 at 3:15






Adding a hint would show it under the checkbox
– Anna Kizilova
19 hours ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

5dY6e2Vb1ghJq,eLm8qs4vui,h3u1HlH3XZw956 SzjDe5sz8Q AKZC16KYzlDJi4VNeYB gFjed0Z2xVx89cSrN0dTh
BV5 M 3Lx rrUyhaISNY7p,sMmAhYT

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications