Skip to content

The easiest way to install modern CSS themes for SimpleForm.

License

Notifications You must be signed in to change notification settings

JuanVqz/simple_form-theme

Repository files navigation

Gem Version

SimpleForm::Theme

Short description and motivation.

Supported CSS Frameworks

Installation

Add this line to your application's Gemfile:

gem 'simple_form-theme'

And then execute:

bundle

As an alternative instead of adding an additional dependency to your project, you can copy the initializer file to your project from the GitHub repository.

Example:

cp lib/generators/simple_form/theme/templates/config/initializers/simple_form_tailwindcss.rb yourapp/config/initializers/simple_form_tailwindcss.rb

However, if you install the gem, you will get the latest updates and improvements.

Requirements

  • Make sure you have installed simple_form gem.
  • Make sure you have installed the decired css framework.

Usage

Install Tailwind CSS files

bin/rails generate simple_form:theme:tailwind install

After running this generator, you will see the config/initializers/simple_form_tailwindcss.rb file. This file adds the Tailwind CSS styles to your application. Additionally, the config/locales/simple_form_tailwind.en.yml file will add the "required" mark to the required fields. However, you need to communicate Tailwind to "watch" those files by adding the following configuration:

# tailwind.config.js

module.exports = {
  ...
  content: [
    './config/initializers/simple_form_tailwindcss.rb',
    './config/locales/simple_form*.yml',
    ...
  ],
}

Install Bulma CSS files

bin/rails generate simple_form:theme:bulma install

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/JuanVqz/simple_form-theme

License

The gem is available as open source under the terms of the MIT License.