Hfyuu
Hfyuu

Reputation: 199

How to change label of simple form input

I Have a code in my project like

<div class="form-inputs">
  <%= f.input :twitter %>
</div>

It gives label as Twitter in my website. How it produce label with out giving label parameter. I want to change label to something else like Tweet it.

Upvotes: 4

Views: 2927

Answers (1)

Tanay Sharma
Tanay Sharma

Reputation: 1164

You can add label in very simple way

<%= f.input :twitter, label: 'Tweet it' %>

Check this simple_form usage

If you want to disable label

<%= f.input :input_field_name, label: false %>

Add custom class to label

<%= f.input :field_name, label_html: { class: 'my_class' } %>

Upvotes: 6

Related Questions