UI Components Library for Rails Apps Designed with Hotwire

Hotwire is a set of technologies for building modern, responsive web applications without writing complex JavaScript. When combined with Rails Designer, it provides a powerful way to create dynamic, interactive UI components for your Ruby on Rails applications.

Why Rails Designer Uses Hotwire?

Hotwire brings several advantages to Rails’ ecosystem:

  1. Simplicity: Create dynamic interfaces with the HTML you already have;
  2. Performance: Achieve near-instantaneous page updates without full page reloads;
  3. Progressive Enhancement: Build apps that work with or without JavaScript;

Getting Started

To begin using Hotwire with Rails Designer, follow these steps. Add the Hotwire gems to your Rails application’s Gemfile:

gem "turbo-rails"
gem "stimulus-rails"

Then run the one command to install Rails designer: rails app:template LOCATION="https://railsdesigner.com/setup/". This will set up Rails Designer in your Rails app. Check out the quickstart guide for all the details.

Adding Hotwire Components with Rails Designer

With Rails Designer and Hotwire, creating interactive UI components is straightforward:

  1. Browse the extensive component library that comes with Rails Designer;
  2. Generate a new component using Rails Designer’s CLI, e.g., bin/rails generate rails_designer:component Elements::Dropdown;
  3. Select and copy one of the Hotwire-enabled variants from the library.

From here, you can easily customize the component to fit your exact needs.

Want to learn more about using Hotwire effectively in your Rails projects? Check out the Rails designer articles for tips and ideas on building interfaces with Hotwire in Rails apps.