formulator v0.0.6 Formulator
Summary
Functions
Returns an html input with an associated label. If there are errors associated with the field, it will also output a span tag with the errors
Functions
Specs
input(Phoenix.HTML.Form.t, atom, []) :: binary
Returns an html input with an associated label. If there are errors associated with the field, it will also output a span tag with the errors.
Options
:label
- When given a keyword list, the keywordtext
is extracted to use as the label text. All other options are passed along to the label. When givenfalse
, does not create a label tag. Instead, anaria-label
attribute is added to the input to improve accessibility.
Examples
Basic input:
<%= input form, :email %>
#=> <label for="user_email">Email</label>
#=> <input id="user_email" name="user[email]" type="text" value="">
Without a label:
<%= input form, :email, label: false %>
#=> <input id="user_name" name="user[email]" aria-label="email" type="text" value="">
Passing other options:
<%= input form, :email, label: [class: "control-label"] %>
#=> <label class="control-label" for="user_email">Email</label>
#=> <input id="user_email" name="user[email]" type="text" value="">