Skip to content

RFC: Core Components

Dario Leidi edited this page Nov 3, 2023 · 7 revisions

Former kickoff discussion: https://trello.com/c/UYp45jP5/29-create-a-set-of-core-view-components

Proposal

Use View Components to create a set of core components to be reused across the project in order to standardize the implementation of similar objects.

Definition of a Core Component

A core component is meant to be a composition of elements that can be considered reusable for the same purpose in multiple circumstances, it doesn't matter the level of the internal complexity: it might be a single atomic element or a nested connection of multiples.

Pros and Cons

Pros

  • consistency: all the same category elements aligned and shaped in the same way
  • unified reusable implementation
  • view components tests, previews and more built-in mechanisms
  • prevent overlapping between different implementation of the same things on different occurrences

Cons

  • in some case it might seem to be a re-implementation of utilities and helpers they already exist, especially if the core component is an atomic one, or it might feel like an HTML element wrapping implementation (helpers lik content_tag, or link_to, button_tag, etc already exist)
  • hard to move and reach to a state where core components are the only implementation in place
Clone this wiki locally