A helper with a block renders its component around whatever the block outputs. Inside the block you write normal ERB, including other Componeer helpers, partials or your own markup. That is how screens are built: a stack of cards, a card holding a table, a table cell holding a status_pill.
Para hoje
Sexta, 20 de novembro
Quests ativas
| Quest | Progresso |
|---|---|
| Lançar o canal | 5 de 13 |
| Faturar o cliente exemplo | Contínua |
<% missions = [
{ title: "Revisar roteiro do vídeo 2", quest: "Lançar o canal", late: true },
{ title: "Emitir invoice de novembro", quest: "Faturar o cliente exemplo", late: false }
] %>
<%= stack do %>
<%= card(title: "Para hoje", subtitle: "Sexta, 20 de novembro") do |today| %>
<% today.with_action { counter missions.size } %>
<%= stack(gap: "8px") do %>
<% missions.each do |mission| %>
<%= cluster(style: "justify-content: space-between") do %>
<span><strong><%= mission[:title] %></strong> <span class="tr-muted">· <%= mission[:quest] %></span></span>
<%= status_pill "Atrasada há 1 dia", status: :bad if mission[:late] %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= card(title: "Quests ativas", flush: true) do %>
<%= table(rows: [ { title: "Lançar o canal", progress: "5 de 13" }, { title: "Faturar o cliente exemplo", progress: "Contínua" } ]) do |t| %>
<% t.column("Quest") { |quest| quest[:title] } %>
<% t.column("Progresso", align: :right) { |quest| quest[:progress] } %>
<% end %>
<% end %>
<% end %>
Slots
Some components have named areas besides their main content: a card's actions and footer, a page header's filters and tabs. The block receives the component; call with_<slot> on it to fill a slot. A slot's block can itself call helpers.
Slots that hold a single helper read well as one-liners: header.with_action { button "Sincronizar", variant: :primary }.
Lançar o canal até março
Canal Exemplo · prazo 31/03/2027
Ter o canal no ar com 8 vídeos publicados e uma rotina semanal de produção.
<%= card(title: "Lançar o canal até março", subtitle: "Canal Exemplo · prazo 31/03/2027") do |c| %>
<% c.with_action { status_pill "Ativa", status: :accent } %>
<% c.with_action { icon_button "pencil", label: "Editar quest" } %>
<p>Ter o canal no ar com 8 vídeos publicados e uma rotina semanal de produção.</p>
<% c.with_footer do %>
<%= button "Abandonar…", size: :sm, variant: :danger %>
<%= button "Concluir quest", size: :sm, icon: "check" %>
<% end %>
<% end %>
Layout blocks
stack piles blocks vertically with a 16px gap; cluster lines up inline items that wrap. Both take gap: and any HTML attribute.
Bloco A
Bloco B
<%= stack do %>
<%= card(title: "Bloco A") { "Stack empilha blocos com 16px entre eles." } %>
<%= card(title: "Bloco B") do %>
<%= cluster do %>
<%= button "Um", size: :sm %><%= button "Dois", size: :sm %><%= status_pill "Três", status: :neutral, dot: false %>
<% end %>
<% end %>
<% end %>