There's a lot of open issues
A collection of ViewComponents implementing DaisyUI design system
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 8.0.1
 Project Readme

codecov

DaisyComponents

DaisyComponents is a Ruby gem that provides a collection of ViewComponents implementing the DaisyUI design system for Rails applications. It combines the power of ViewComponent, TailwindCSS, and DaisyUI to create reusable, maintainable UI components.

Features

  • Built on top of ViewComponent for component-based architecture
  • Implements DaisyUI's design system, based on TailwindCSS
  • Live preview and documentation with Lookbook
  • Comprehensive test coverage with Minitest

Installation

Automated Setup (Recommended)

For new contributors or fresh environments, use the automated setup script:

$ ./bin/setup

This script will:

  • Detect your OS and CPU architecture
  • Install mise if not already present
  • Install the latest Ruby version
  • Install Bundler if needed
  • Run bundle install to install dependencies
  • Provide clear instructions for using the environment

Add this line to your application's Gemfile:

gem "daisy_components"

And then execute to install the gem and other dependencies:

$ bundle install

Usage

The component library includes Lookbook for development and documentation:

  1. Start the development server:
$ bin/rails server
  1. Visit http://localhost:3000/lookbook to see the component documentation and playground.

alt text alt text alt text

Testing

Run the test suite:

$ bin/rails test

With coverage:

$ COVERAGE=true bin/rails test

Code Quality

Trailing Newlines

Use the dedicated script to check and fix trailing newline issues:

# Check all files (excludes vendor/, node_modules/, tmp/, log/, coverage/, etc.)
$ ./bin/fix_trailing_newlines.sh --check-only

# Fix all files  
$ ./bin/fix_trailing_newlines.sh

# Check only staged files (used by git hooks)
$ ./bin/fix_trailing_newlines.sh --staged-only

Git Hooks

A pre-commit hook is available that automatically performs code quality checks:

$ ./bin/setup_hooks.sh

The hook will run before each commit and will:

  • Fix trailing newlines automatically in staged files
  • 🔧 Run RuboCop on staged Ruby files (will block commit if issues found)

Note: Git hooks are not automatically shared when cloning a repository. Each developer needs to run the setup script once after cloning.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b feature/my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-new-feature)
  5. Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.