CubitComponents

A collection of reusable ViewComponents with standardized styling and utility class validation.

Installation

Add to your Gemfile:

gem 'cubit_components'

Then run:

bundle install

Usage

Basic Component

<%= render CubitComponents::BoxComponent.new do %>
  Box content
<% end %>

With Custom Classes

<%= render CubitComponents::StackComponent.new(classes: "bg-gray-100") do %>
  <div>Item 1</div>
  <div>Item 2</div>
<% end %>

Available Components

  • BoxComponent - Basic container
  • StackComponent - Vertical layout
  • ColumnsComponent - Horizontal layout
  • BleedComponent - Negative margins
  • ContentBlockComponent - Width-constrained container

Configuration

Create an initializer to customize validation behavior:

# config/initializers/cubit_components.rb
CubitComponents.configure do |config|
  config.invalid_vattr_behavior = :raise # :warn, :silent
end

Development

After checking out the repo:

bin/setup
bundle exec rspec

License

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