Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

How to create a form with Beyond Canvas styles

Unai Abrisketa edited this page Oct 29, 2020 · 3 revisions

First of all, you'll need to make your controller use some of the layouts provided by Beyond Canvas:

class UsersController < ApplicationController
  layout 'beyond_canvas/public'
end

We recommend setting the beyond_canvas/public layout for the ApplicationController so all controllers inheriting from ApplicationController will use the same layout.

Then you are able to use a html structure like the following to create your form:

<div class="card card--padding">
  <%= form_for @user, builder: BeyondCanvas::FormBuilder do |f| %>

    <h2 class="card__headline">Create your account</h2>

    <%= f.email_field :email, label: 'Your email' %>
    <%= f.password_field :password, label: 'Your password', hint: 'Must contain letters and numbers.' %>

    <div class="form__actions--left">
      <%= f.button 'Save', type: :submit, class: 'button__solid--primary' %>
    </div>

  <% end %>
</div>

Clone this wiki locally