Your own components

Register an app component and it becomes a helper too.

Build app-specific blocks the same way: a ViewComponent (subclassing Componeer::BaseComponent gives you html_attributes, icon_svg and option!) whose template uses Componeer helpers. Keep the markup in the template and the logic in the class. Register it in an initializer and call it like any built-in.

A name that would override an Action View helper (select, label, search_field…) is refused at boot.

Ruby
# app/components/quest_card_component.rb
class QuestCardComponent < Componeer::BaseComponent
  def initialize(quest:)
    @quest = quest
  end
end
ERB
<%# app/components/quest_card_component.html.erb %>
<%= card(title: @quest.title, subtitle: @quest.project.name) do |c| %>
  <% c.with_action { status_pill @quest.status_label, status: :accent } %>
  <%= content %>
<% end %>
Ruby
# config/initializers/componeer.rb
Componeer.register :quest_card, "QuestCardComponent"
ERB
<%# any view %>
<%= quest_card(quest: @quest) do %>
  <%= render @quest.missions %>
<% end %>

Extra icons

Point Componeer at folders of your own SVGs. They are looked up before the bundled Tabler set, so icon "logo" finds app/assets/icons/logo.svg.

Ruby
Componeer.configure do |config|
  config.icon_paths << Rails.root.join("app/assets/icons")
end