Adds a configuration object singleton to ViewComponent::Form
Adds configuration option parent_component which all ViewComponent::Form components inherit from, and defaults to ViewComponent::Base
Why
So that one can define shared logic without having to use concerns or building their own components that don't inherit from their ViewComponent::Form component counterpart.
As an example, let's say I'd like to use the heroicon gem to add icons to my fields, I can do that easily by defining my own ApplicationFormComponent
class ApplicationFormComponent < ViewComponent::Base
include Heroicon::Engine.helpers
end
or, if I'm using Tailwind, I could use tailwind_merge to merge HTML classes to avoid conflicts, etc.
What
ViewComponent::Form
parent_component
which allViewComponent::Form
components inherit from, and defaults toViewComponent::Base
Why
So that one can define shared logic without having to use concerns or building their own components that don't inherit from their
ViewComponent::Form
component counterpart.As an example, let's say I'd like to use the heroicon gem to add icons to my fields, I can do that easily by defining my own
ApplicationFormComponent
or, if I'm using Tailwind, I could use tailwind_merge to merge HTML classes to avoid conflicts, etc.