rails g view_component NomeDoComponente
with stimulus:
rails g view_component NomeDoComponente –stimulus
File: - component.html.erb html for the component - component.rb ruby code for internal component logic - preview.rb preview for lookbook - /spec/component_spec.rb spec for component with rspec
# frozen_string_literal: true require "rails_helper" describe <%= class_name %>::Component do let(:options) { {} } let(:component) { <%= class_name %>::Component.new(**options) } it "renders" do result = render_inline(component) expect(result).to have_css "div" end end