Skip to content

v0.9.0 - Form Builder

Compare
Choose a tag to compare
@stephannv stephannv released this 21 Sep 13:29
· 13 commits to main since this release
3cbbb17

Using #form_builder you can access some utility methods to build labels and inputs:

class ExamplePage
  include Blueprint::HTML

  def blueprint
    form_builder action: "/sign-in", method: :post do |form|
      form.label :email
      form.email_input :email

      form.label :password
      form.password_input :password
    end
  end
end

puts ExamplePage.new.to_s
# <form action="/sign-in" method="post">
#   <label for="email">Email</label>
#   <input type="email" id="email" name="email">
#
#   <label for="password">Password</label>
#   <input type="password" id="password" name="password">
# </form>

More examples at docs: https://stephannv.github.io/blueprint-docs/handbook/forms/