Project

kozenet_ui

0.0
The project is in a healthy, maintained state
Kozenet UI is a modern, production-ready component library for Ruby on Rails. Built with ViewComponent and Tailwind CSS, it provides beautiful, accessible, and customizable UI components with dynamic theming support. Features CSP-compliant styling, dark mode, and smooth animations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 2.0
~> 3.0
~> 2.0
~> 13.0
~> 3.0
~> 1.50

Runtime

~> 1.8
>= 7.0, < 9.0
>= 3.0, < 5.0
 Project Readme

Ruby CI Kozenet UI CI

Kozenet UI

Beautiful, minimal, Apple-inspired UI components for Rails.

Installation

For local gem development, point the Rails app at this checkout:

gem "kozenet_ui", path: "../.."

Then run:

bundle install
bin/rails generate kozenet_ui:install

For an app outside this repository, use GitHub:

gem "kozenet_ui", github: "kozenetpro/kozenet_ui"

Or use the released RubyGems version:

bundle add kozenet_ui

Then run:

bin/rails generate kozenet_ui:install

gem install kozenet_ui is not enough for a Rails app. The app must have kozenet_ui in its Gemfile, because Rails generators are loaded through Bundler.

Usage in your Rails app

Usage guides live in docs:

  1. Load Kozenet UI once from your layout <head>:

    <%= kozenet_ui_head_tags %>

    This loads digested CSS assets, theme variables, and JavaScript. When using importmap, keep this after javascript_importmap_tags.

    In Rails 8 apps using stylesheet_link_tag :app, the install generator copies Kozenet UI styles into app/assets/stylesheets/kozenet_ui and inserts:

    <%= kozenet_ui_head_tags(stylesheets: false) %>
  2. Customize copied styles when needed: The install generator copies Kozenet UI CSS into app/assets/stylesheets/kozenet_ui, so developers can edit the frontend without touching gem internals.

  3. Only use CSS imports when you have a CSS bundler:

    @import "kozenet_ui/tokens.css";
    @import "kozenet_ui/fonts.css";
    @import "kozenet_ui/base.css";
    @import "kozenet_ui/components/button.css";
    @import "kozenet_ui/components/header.css";
    @import "kozenet_ui/components/avatar.css";
    @import "kozenet_ui/components/badge.css";
    @import "kozenet_ui/components/utilities.css";

    For plain Propshaft/Sprockets apps, prefer kozenet_ui_head_tags, because stylesheet tags generate digest-safe production asset URLs.

  4. Skip direct stylesheet tags if your app bundles the CSS itself:

    <%= kozenet_ui_head_tags(stylesheets: false) %>
  5. Use Heroicons by name:

    <% header.with_action_button(href: "/saved", icon: :heart, label: "Saved") %>
    <% header.with_action_button(href: "/cart", icon: :shopping_cart, label: "Cart") %>

    Kozenet UI normalizes Ruby-style names like :shopping_cart to Heroicons' shopping-cart name.

  6. Customize colors and component defaults in config/initializers/kozenet_ui.rb:

    KozenetUi.configure do |config|
      config.theme = :system
      config.stimulus_prefix = "kz"
      config.component :header, sticky: true, blur: true
    end

    Per-render options still win:

    <%= kz_header(sticky: false) do |header| %>
      ...
    <% end %>
  7. Use components in your views:

    <%= render KozenetUi::HeaderComponent.new do |header| %>
      ...
    <% end %>

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kozenetpro/kozenet_ui. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

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

Code of Conduct

Everyone interacting in the KozenetUi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.