Skip to main content
Spree Admin Dashboard uses Tailwind CSS v4 for styling. The stylesheet system is designed to be easily customizable while maintaining consistency with the Spree design system.

How It Works

When you install Spree Admin, the installer creates a file at app/assets/tailwind/spree_admin.css in your application. This file:
  1. Imports the base Spree Admin styles from the gem
  2. Scans your custom admin views, helpers, and JavaScript for Tailwind classes
  3. Allows you to add custom styles and override theme variables

Using Tailwind Utility Classes

You can use any Tailwind CSS utility class in your custom admin views, helpers, or JavaScript files. The build process automatically scans these locations:
  • app/views/spree/admin/**/*.erb
  • app/helpers/spree/admin/**/*.rb
  • app/javascript/spree/admin/**/*.js
Example usage in a view:

Customizing the Theme

Overriding Theme Colors

To override Tailwind theme values, add a @theme block in your app/assets/tailwind/spree_admin.css file after the import:
app/assets/tailwind/spree_admin.css

Available Theme Variables

The Spree Admin theme defines these customizable variables:
VariableDefaultDescription
--color-primaryvar(--color-zinc-950)Primary brand color
--color-successvar(--color-green-900)Success state color
--color-dangervar(--color-red-600)Error/danger state color
--color-warningvar(--color-yellow-900)Warning state color
--color-infovar(--color-blue-900)Info state color

Overriding Layout Variables

You can also customize layout-related CSS variables:
app/assets/tailwind/spree_admin.css

Adding Custom Components

Use Tailwind’s @layer directive to add custom component styles that work seamlessly with the existing design:
app/assets/tailwind/spree_admin.css

Adding Custom Utilities

For reusable utility classes, use the utilities layer:
app/assets/tailwind/spree_admin.css

Scanning Additional Paths

If you have admin-related code in non-standard locations, add additional @source directives:
app/assets/tailwind/spree_admin.css

Development Workflow

Starting the CSS Watcher

During development, run the Tailwind CSS watcher to automatically rebuild styles when you make changes:
Or run the full development process, which includes the watcher when it’s defined in Procfile.dev:
The watcher monitors:
  • Your host app’s CSS files in app/assets/tailwind/
  • The Spree Admin engine’s CSS files
  • All files matching your @source patterns

Building for Production

CSS is automatically compiled during asset precompilation:

Common Customization Examples

Custom Primary Color Scheme

app/assets/tailwind/spree_admin.css

Dark Mode Adjustments

app/assets/tailwind/spree_admin.css

Custom Form Styling

app/assets/tailwind/spree_admin.css

Troubleshooting

Changes Not Appearing

  1. Ensure the watcher is running: bin/rails spree:admin:tailwindcss:watch
  2. Check that your files are in paths covered by @source directives
  3. Hard refresh the browser (Cmd+Shift+R or Ctrl+Shift+R)

Missing Utility Classes

If a Tailwind class isn’t working, ensure:
  1. The class is used in a file that’s scanned by @source
  2. The class name is complete (not dynamically constructed)
  3. Run a fresh build: bin/rails spree:admin:tailwindcss:build

Listen Gem Required

The watch task requires the listen gem. Add it to your Gemfile:
Gemfile