No release in over 3 years
Low commit activity in last 3 years
Simple style guide for Rails 7.2+
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 7.2.0
>= 3.5.0
 Project Readme

Elemental Style Guide

Important

This gem, as well as the elemental_components gem, is no longer maintained. Some of the ideas and concepts were merged into the view_component gem, which is actively maintained as of 2026.

Simple style guide for Rails 7.2+, designed to go well with elemental_components. The two together are inspired by the works of Brad Frost and by the thoughts behind Lonely Planet's style guide Rizzo.

Installation

Add this line to your application's Gemfile:

gem "elemental_styleguide"

And then execute:

$ bundle

Run the install generator:

$ bin/rails g elemental_styleguide:install

This will create the following files and directories:

app/
  controllers/
    styleguide/
      examples_controller.rb
  views/
    layouts/
      styleguide/
        example.html.erb
    styleguide/
      01_home.md

The style guide can be mounted in your routes file with:

mount ElementalStyleguide::Engine => "/styleguide"

You can now access the style guide at http://localhost:3000/styleguide.

Pages

You can create style guide pages simply by adding markdown files to the app/views/styleguide directory. These can be structured by putting them in subdirectories, and sorted by prefixing the file names with a digit.

Check out Brad Frost's Style Guide Guide for style guide inspiration.

Examples

A special markdown syntax, inspired by Catalog, can be used to render examples of any erb code on the style guide page, in the context of your own application:

# Example

```example
<%= "Hello world" %>
```

It is possible to pass options to the example, in order to control the width and height of the wrapping element:

```example
width: 500
height: 200
---
<%= "Hello world" %>
```

Examples need your application's CSS and JS in order to function properly. There is an app/views/layouts/styleguide/example.html.erb layout file that examples are rendered within. This file can be modified in order to include any CSS and JS needed.

Acknowledgements

This library, together with elemental_components, was inspired by the writings of Brad Frost on atomic design and living style guides, and Rizzo, the Lonely Planet style guide. Other inspirations were:

For a list of real world style guides, check out http://styleguides.io.