⚡
LightningRails
  • 👋Welcome
  • Access the Repo
  • Getting Started
    • 🚀Quickstart
    • 🎨Themes
    • 🖼️Customize the views
    • 🔮DaisyUI Library
    • ⚡Lightning Landing
      • Quickstart
      • Theme and branding
      • Page structure
      • Publish your landing page
  • Features setup
    • 📸Images & media
    • 🔐Admin Dashboard
    • Search Engine Optimization
    • 📧Automatic Emails
      • 🟨Postmark
      • 🔲Resend
    • 🚪Login with Devise
    • 🪄Magic Link Signup
    • 💳Stripe Payment Gateway
    • Github Signup
    • Lucide icons
    • 🤖Multi-provider AI
    • Open AI API
  • UI Components
    • 🦸Heros
    • ❔FAQs
    • 🃏cards
    • 💬Testimonials
    • 👋Call To Actions
    • 🔦Features
  • Deploying to production
    • ⬆️Heroku Deploy
    • 🛡️Security
      • 🎛️Rate Limiting
  • RESOURCES
    • 🚀Vote for new features
    • Report an issue
    • 🆘Get help on Slack
    • 🍭Design Resources
      • Maria Ba Illustrations
      • Assets Mockup Generator
      • Logo Generator
      • Tailwind Cheatsheet
      • HyperUI Tailwind Library
Powered by GitBook
On this page
  • Using Tailwind Front-end Components in Your Ruby on Rails Application
  • Using DaisyUI Components
  • Rendering Tailwind Components included by default in Lightning Rails

Was this helpful?

  1. Getting Started

Customize the views

How to change the views using LightningRails partials/components

PreviousThemesNextLightning Landing

Last updated 8 months ago

Was this helpful?

Using Tailwind Front-end Components in Your Ruby on Rails Application

In our Ruby on Rails application, we utilize Tailwind CSS for styling, complemented by components from the DaisyUI library. You will find the custom Tailwind components organized in the views > components folder.

Using DaisyUI Components

We use DaisyUI to enhance our Tailwind components with pre-designed UI elements. DaisyUI provides various components that you can easily integrate into your application, allowing for rapid and responsive UI design.

Feel free to check out their library and incorporate any components that fit your design needs into our application!


Rendering Tailwind Components included by default in Lightning Rails

To include Tailwind components in your views, simply use the render ERB tag. This makes it super easy to integrate components throughout your application.

How easy is it? The entire LightningRails home page is built with just 7 lines of code (already included in the boilerplate) 🤯:

# views/home.html.erb
<%= render "components/hero" %>
<%= render "components/featured_on" %>
<%= render "components/text_image" %>
<%= render "components/feature_tabs" %>
<%= render "components/price_cards" %>
<%= render "components/faq" %>
<%= render "components/cta_horizontal" %>

(Optional) - Passing Instance Variables to Components

If you have instance variables in your controller and want to pass them to a button component, here's how you can do it:

  1. Pass any variable to the component:

    When rendering the button component in your view:

    <%= render 'components/button', locals: { label: @button_label, color: @button_color } %>
  2. Access the variables in your component:

    In your _button.html.erb partial, you can now use the label and color variables to customize the button:

    <button class="<%= color %> text-white font-bold py-2 px-4 rounded">
      <%= label %>
    </button>

You can explore the full range of DaisyUI components on their website: .

🖼️
DaisyUI