← Graph

ViewComponent

tool 21 connections

Ruby on Rails gem released by GitHub for building reusable, testable view components. Each component is a Ruby class inheriting from ViewComponent::Base with an ERB template, optionally parameters/validations, and can replace templates/partials. Supports slots (render_one / render_many), previews rendered in isolation (conceptually similar to Rails mailer previews), and RSpec-style assertions/snapshot testing. In Radoslav Stankov's wroclove.rb 2024 talk, used as the backbone for the Angry Building front end: components are nested (stats → stats_number), aliased (`as: :number`), composed via builder patterns, and extended with a custom `component` helper and a fetch-with-fallback for safe enum rendering. Also referenced in Yaroslav Shmarov's wroclove.rb 2022 talk as key to structuring the Rails monolith front-end at Bearer. Contrasted with helpers (global, name-conflict-prone) and decorators (insufficient for UI structure).

category
library
First half of the talk is dedicated to structuring the Rails front-end with ViewComponent.
Design guideline for ViewComponent APIs.
Component design recommendation.
about
ViewComponent tool
Asks how ViewComponent testing compares to React component testing.
about
ViewComponent tool
Central topic of the talk.
about
ViewComponent tool
Criteria for deciding when a piece of UI becomes a ViewComponent.
about
ViewComponent tool
Compares the two approaches.
about
ViewComponent tool
Asks about testability of ViewComponents.
Evaluated and rejected as a view-layer option due to split .rb/.html files and maintainer direction.
about
ViewComponent tool
Cited as an alternative approach to view-logic extraction
Mentioned as another project attacking the view-logic extraction problem
has_skill
ViewComponent tool
Uses ViewComponent extensively in production at Bearer.
level: expert
has_skill
ViewComponent tool
Deep, opinionated practical experience with ViewComponent in production.
level: expert
recommends
ViewComponent tool
Promotes ViewComponent as key to structuring the Rails monolith front-end.
recommends
ViewComponent tool
Entire talk advocates structuring Rails front-ends around ViewComponent.
tool Lookbook
related_to
ViewComponent tool
Lookbook builds on ViewComponent's preview feature.
related_to
ViewComponent tool
Slots are a feature of ViewComponent.
related_to
ViewComponent tool
Pattern applied inside ViewComponent classes, predating slots adoption.
tool Phlex
related_to
ViewComponent tool
ViewComponent team pioneered the 'renderable' abstraction that Phlex implements to get Turbo interop for free.
company Bearer
uses
ViewComponent tool
Bearer structures its front-end around ViewComponent instead of plain partials/templates.
project Angry Building
uses
ViewComponent tool
Front-end is structured entirely around ViewComponent.

Provenance

Read by
19 extractions