A view component library for Ruby and Rails that encapsulates UI into reusable, testable view models.
Cells is a view component library for Ruby and Rails that encapsulates UI into reusable view models. It solves the problem of tangled view logic by moving presentation code into Ruby classes, making components testable, maintainable, and composable. It integrates with the Trailblazer framework and supports various template engines like ERB, Haml, and Slim.
Ruby and Rails developers building complex UIs who need reusable, testable components, especially those using or interested in the Trailblazer architecture. It's ideal for teams prioritizing clean separation of concerns and object-oriented design in their views.
Developers choose Cells for its object-oriented approach to views, enabling encapsulation, easy testing, and reuse without the limitations of Rails helpers. Its integration with Trailblazer, caching, and asset packaging makes it a robust solution for building scalable UI components.
View components for Ruby and Rails.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Encapsulates UI logic in Ruby classes, promoting clean separation of concerns and reusable components, as evidenced by the view model approach that replaces Rails helpers.
Components render to plain HTML, allowing seamless testing with RSpec, MiniTest, or other frameworks, with a consistent API between production and test environments.
Offers caching per state with configurable expiration and dynamic keys, enabling performance optimizations for frequently rendered components without extra gems.
Supports bundling JavaScript, CSS, and images with cells, creating self-contained widgets that integrate with Rails' asset pipeline for encapsulation.
Requires separate gems for ERB, Haml, or Slim templates (e.g., cells-erb) and manual inclusion in non-Rails environments, adding dependency management overhead.
Deep integration with Trailblazer means developers must learn an additional framework for advanced features, with documentation centered around that ecosystem.
The object-oriented layer introduces slight overhead compared to raw Rails views, though caching mitigates this; instantiation and method calls add complexity.