# ViewComponent/view_component

A framework for building reusable, testable & encapsulated view components in Ruby on Rails.

Repository: https://github.com/ViewComponent/view_component
Canonical: https://ross.abutalabs.com/products/view_component
Homepage: https://viewcomponent.org
Language: Ruby
License: MIT
License Family: permissive
Last push: 2026-08-25T21:33:05+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 99, longevity 100
- inputs: {"age_days": 2588, "days_push": 8, "days_rel": 8, "gap_med": 8, "n_releases_24m": 38}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3568, forks 485 (observed 2026-08-28T04:08:10.008677+00:00)

## What it is
ViewComponent is a Ruby framework for building reusable, testable, and encapsulated view components in Ruby on Rails, inspired by React and the presenter pattern. As of version 4 it is feature-complete and in Long-Term Support, with recent releases adding experimental component-level caching support.

## Use cases
- build reusable UI components in Rails
- unit test Rails view templates
- replace partials with encapsulated components
- consolidate view logic scattered across helpers and models
- render view objects from controllers
- speed up view testing compared to controller tests

## When to choose
- you maintain a Rails app with templates reused across views
- you want component-style architecture (React-like) in Rails ERB
- you need fast, direct unit tests for view markup
- your views have heavy embedded Ruby logic that needs encapsulation

## When to avoid
- you are not using Ruby on Rails
- you want a full frontend framework with client-side interactivity
- you need a JavaScript component system like React or Vue
- you prefer simple partials for one-off templates

## Facets
- artifact type: framework
- maturity: maintenance
- function: ui-components, templating, frontend-framework, testing
- domain: web-development, frontend, developer-tools
- platform: ruby
- tags: ruby-on-rails, view-layer, component-based-architecture, unit-testing, presenter-pattern, long-term-support, web-server

## Member repositories
- ViewComponent/view_component (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:10.008677+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:34:09.039867+00:00, confidence not recorded.
  - readme: https://github.com/ViewComponent/view_component (fetched 2026-08-28T04:08:10.008677+00:00, sha 9eb7911f0ce0)
  - homepage: https://viewcomponent.org (fetched 2026-08-29T09:27:45.417986+00:00, sha 97050feeafe6)
  - site_page: https://viewcomponent.org/guide/getting-started.html (fetched 2026-08-29T09:27:45.422371+00:00, sha 3ff85da8ddd4)
  - site_page: https://viewcomponent.org/CHANGELOG.html (fetched 2026-08-29T09:27:45.424477+00:00, sha 302c3f0730f3)
- Data as of 2026-08-30T08:39:29.467469+00:00.
