Field

So many ways to input a string
Includes a Ruby component and corresponding Rails helper
Ruby

Example

Sign in
Let's see those credentials, buddy
Probably something like "password"
At least for a little bit
or sign up
<%= nk_form_for :session do |f| %>
  <%= f.fieldset do |fs| %>
    <%= fs.legend "Sign in" %>
    <%= fs.description "Let's see those credentials, buddy" %>

    <%= f.group do %>
      <%= f.field :email, as: :email, label: "E-mail address" %>
      <%= f.field :password, as: :password %>
      <%= f.field :remember_me, as: :checkbox,
        description: "At least for a little bit" %>
      <%= f.submit "Sign in" %>
    <% end %>
  <% end %>
<% end %>

Composability

If you need more control of a field and its related elements, you can build your own order by passing a block:

<%= nk_form_for :user do |f| %>
  <%= f.field :email, as: :email, label: "E-mail address" do |ff| %>
    <%= ff.label %>
    <%= ff.description %>
    <%= ff.control %>
    <%= ff.errors %>
  <% end %>
<% end %>

Here composed to put a button inline:

We will never send spam... until we're desperate enough

Usage

nk_field(**attrs)
PropertyDefaultDescription
**attrsHTML attributes for <input> element
nk_fieldset(legend: nil, description: nil, **attrs) { |fieldset| ... }
PropertyDefaultDescription
legendnilPlain text content
descriptionnilPlain text content
**attrsHTML attributes for <fieldset> element
fieldset.legend(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <legend> element
fieldset.description(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <div> element
fieldset.group(**attrs) { |group| ... }
PropertyDefaultDescription
**attrsArguments for NitroKit::FieldGroup.new()
nk_field_group(**attrs)
PropertyDefaultDescription
**attrsHTML attributes for <div> element