Menu

Rails

Set up Tabler in Rails and build a first working page.

Rails renders server-side HTML through ERB templates, so Tabler classes work directly in your views. The compiled CSS and JS work with the standard Rails bundling gems (cssbundling-rails and jsbundling-rails).

You'll install @tabler/core, import its assets in your application bundles, and render a first view with a Tabler card.

Setup

Install Tabler package

Install @tabler/core with your preferred package manager:

npm install @tabler/core
yarn add @tabler/core
pnpm install @tabler/core
bun install @tabler/core

You can also use CDN files when you need a quick setup:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/css/tabler.min.css" integrity="sha384-MwEqmM8WBfwWX5LiVzgcxav7Srl1u+b/gBJPodcWJTvwWJ9c7bLJXWhyiWtEqXkQ" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/@tabler/[email protected]/dist/js/tabler.min.js" integrity="sha384-CKrlmuNx52figWamK99uxnpR2acAc72jno6l+yhg0UTAcW+glcS7QsJ1lEApFaY/" crossorigin="anonymous"></script>

Import styles

For Rails with cssbundling-rails, import Tabler CSS in app/assets/stylesheets/application.scss:

@import '@tabler/core/dist/css/tabler.min.css';

To change Sass variables, compile the SCSS sources instead:

@use '@tabler/core/scss/tabler';

Sass alone writes custom properties without the --tblr- prefix, so you also need a PostCSS step. Customize with Sass shows how to set it up.

Import and initialize JavaScript

Tabler JavaScript is required for interactive components such as dropdowns, modals, and tooltips.

If you use jsbundling-rails, import Tabler JS in app/javascript/application.js:

import '@tabler/core/dist/js/tabler.min.js'

If you use importmap-rails without npm bundling, prefer the CDN for Tabler JS. You can also add the compiled files to your asset pipeline and include them from your layout.

Minimal working example

Create a simple layout in app/views/layouts/application.html.erb:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
    <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
  </head>
  <body>
    <%= yield %>
  </body>
</html>

Then add a simple page in app/views/home/index.html.erb:

<div class="page">
  <div class="page-wrapper">
    <div class="container-xl py-4">
      <div class="card">
        <div class="card-body">
          <h3 class="card-title">Rails + Tabler</h3>
          <p class="text-secondary mb-0">Your Tabler setup is working.</p>
        </div>
      </div>
    </div>
  </div>
</div>

Run the app:

bin/rails server

Open the local Rails URL and confirm the card is styled with Tabler.

Next steps

  • Continue with Customize to adjust styles and build setup.
  • Explore Layout to choose page structures.
  • Browse Components to add UI building blocks.