https://businessclasskit.com/blog/design-system-options-for-rails
Business Class Blog Rails starter kit
Design system options for Rails
Table of contents
Building design systems
Component systems for Rails
shadcn/ui
shadcn/ui on Rails
daisyUI
Flowbite
Preline
RubyUI
Conclusion
You would think that picking a well-made design system for your
application is a solved task in 2025. But not for Rails and therefore
not for Business Class. When I started Business Class, there wasn't
really a thing to adopt and somehow it still feels the same.
Building design systems
I am not a big designer, although I do try to improve in this regard
(I bought the book Refactoring UI from the authors of Tailwind, among
other things) and I have been part of implementing a design system a
few times. The last time we were implementing it from scratch for
Phrase with ViewComponent library.
I was originally thinking that Business Class should just adopt
something that's already out there, because building things from
scratch are super time-consuming. However, the choices weren't
convincing at the time and I just started with Bulma. Later with the
release of Tailwind 3 I made a switch and build a simple design with
plain Tailwind and @apply .
I think the basic design works well, but it's not a component design
system people might expect to work with in 2025. So let's reevaluate
our options for the future and if we can finally pick something
already made.
Component systems for Rails
There are still only a couple of options we can truly consider for
Business Class. Please note that I can only include free or at least
freemium design systems, not paid ones.
shadcn/ui
Shadcn/UI is an open-source collection of beautifully designed,
reusable UI components built on top of React, Tailwind CSS, and Radix
UI. It provides clean, accessible, and customizable building blocks
that help developers quickly create modern web applications. Shadcn/
UI emphasizes simplicity, developer experience, and adherence to
industry-standard best practices, making it easy to integrate into
various projects and workflows.
[l0eqw8bptz]
Since it's made for React you would use it like this:
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion"
export function AccordionDemo() {
return (
Is it accessible?
Yes. It adheres to the WAI-ARIA design pattern.
Is it styled?
Yes. It comes with default styles that matches the other
components' aesthetic.
Is it animated?
Yes. It's animated by default, but you can disable it if you prefer.
)
}
If we want to use it in Rails, we have to provide our own
implementation.
shadcn/ui on Rails
The original shadcn/ui is made for React and won't help us that much
for a plain Hotwire-based apps. Luckily someone already started
shadcn/ui on Rails, the shadcn/ui implementation with helpers,
partials, and Stimulus controllers.
At first, this looks perfect. Getting a Rails version of a mature
project is a win in itself, but the ability to build hybrid apps with
React and use the same system is even better. However, that's a first
look. The second look will reveal that it's not complete and 1:1
version of the original.
Here's how it looks like to use a component in a view:
<% items = [{:value => "Ruby on Rails", name: "Ruby on Rails"}, {:value => "Next.js", name: "Next.js"}, {:value => "Remix.run", name: "Remix.run"}] %>
<%= render_combobox items do %>
<%= combobox_trigger do %>
Select framework
<% end %>
<% end %>
Still, I like the decision of using partials and Stimulus controllers
and having everything wrapped in helpers. It's in and out a very
Railsy approach. It's a strong contender.
daisyUI
Another component library for Tailwind CSS is daisyUI, designed to
streamline web development by providing customizable, ready-to-use UI
components. It's one of the most used alternatives to shadcn/ui with
a decent history of its own.
[rz5392j7na]
daisyUI implements Tailwind class names for all common UI components
so in practice we can use nice shortcuts like btn or card . It's
little bit like Bootstrap and Bulma but on Tailwind. Personally, I
appreciate the short class names and not polluting the HTML.
Here's an example:
The latest daisyUI 5 that builds on Taiwind 4 looks really nice and
offers a lot of nice prebuilt themes:
[5ijlf59r63]
The biggest downside is that DaisyUI doesn't ship with JavaScript.
It's primarily a visual system.
Flowbite
Flowbite is an open-source UI library built upon Tailwind CSS,
offering a collection of various components and utilities to
streamline the development of responsive and modern web applications.
[6rax4xm38h]
What I like is that Flowbite officially support several framework
including Rails. The JavaScript is generic and not React-specific.
This alone is very nice since we don't need to reimplement anything
ourselves.
Here's a snippet of a component in Flowbite:
Update Product
As you can see you use the Tailwind directly together with data
attributes and aria labels. Here's a corresponding JavaScript we need
to add:
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById('updateProductButton').click();
});
Unlike the previous options, Flowbite isn't entirely open source.
Still, the basic building blocks are and could be enough for a new
Business Class theme.
Preline
Preline is another freemium UI library built upon Tailwind CSS with
its own framework-independent JavaScript. It features a lot of
components and examples, including those for building marketing pages
and what not.
[hf2wyezcnp]
Here's how an authentication box would look like in code with
Preline:
```html
Sign in
Don't have an account yet? Sign up here
Sign in with Google
Or
RubyUI
So far, we looked at popular design systems and their use in Rails.
But there is one significant effort being developed directly for Ruby
called RubyUI. It's also built on top of Tailwind and provides easy
installation instructions for both JavaScript bundlers and
Importmaps.
[5t4x98420d]
The whole project is really full of green flags, but it's not without
a potential downside. It's a system made for Phlex, an alternative
view layer for Ruby. If you have never heard about it, here's how the
component might look like:
AspectRatio(aspect_ratio: "4/3", class: "rounded-md overflow-hidden border shadow-sm") do
img(
alt: "Placeholder",
loading: "lazy",
src: image_path('pattern.jpg')
)
end
It's a pure Ruby component that will be included in pure Ruby view.
So no ERB or anything like that. On one hand it's pretty cool, on the
other I am not 100% convinced to leave ERB for greener pastures. I
always loved being able to just work inside HTML.
Conclusion
So what have we learned? The choices are a bit better than before,
but there is not a single ultimate choice outshining the others. One
thing is clear tho, going the Tailwind route was likely a good
choice, and we should keep building on top of Tailwind whether that's
with a pre-made UI or Business Class own theme.
[logo_squared]
(c) Business Class Blog