
Now our :my_switch component will use the wrapper :my_wrapper by default. In this folder create a new file called my_switch_input.rb and start by writing the following: Start by adding a new folder to your app directory called inputs if it does not already exist. We will create a custom input called my_switch which will output the above markup automatically.

Let’s write a custom input component for the materialize switch. This Materialized sublime plugin contains snippets of Materialized CSS components. We can also use simple form to write our own custom input components.

This will create a button with type submit. We can use this in simple form by writing: In simple_form.rb write:Ĭonfig.button_class = “btn waves-effect waves-light” We can tell simple form to use a default button class. Materialize CSS comes with button classes that we can use to give our buttons a nice effect when clicked. This adds a class of “newclass” to our wrapper div and changes the label to display “New label”. You can use the following haml to create a mobile responsive navbar that includes a drop down menu The following would produce the materialize menu icon You can then specify icons by name inside an “i” tag with class ‘material-icons’. In the head of your document use an external stylesheet linking to the google material icons. It also comes with a responsive container class that you can use to wrap your body content. It comes with a 12 column grid layout that uses small, medium and large columns for different device sizes. Materialize uses some conventions that bootstrap users will find familiar. = require materialize-sprockets Using Materialize You can then include other pages such as ‘home’ or ‘main’ by “main” įinally, in your application.js you need to require jQuery and materialize-sprockets by writing: Remember that since we are using the sass css precompiler, we will also need to include: Set UpĬonveniently, there is a gem that bundles materialize with rails.
#MATERIALIZE GRID HOW TO#
Here I’ll walk you through a tutorial on how to use materialize with ruby on rails with a focus on simple form. You can read more about Material Design at Google’s website. User interaction such as clicks are accompanied by small yet engaging and visually appealing effects.

Components feel sharp and generally stand out in a subtle yet noticeable way. In general, I would describe material design as being very focused with a kind of minimalist aesthetic. Materialize is a CSS framework built around Google’s Material Design principles.
