FormSection
layout stacked/aside · columns 1/2/3
Agrupa campos relacionados num card com título, descrição e rodapé de ações.
Campos entrando
<div> <div class="mb-2.5 animate-[mo-stg_6s_cubic-bezier(.2,.8,.2,1)_infinite]"> <.input label="Razão social" placeholder="Mercadinho Bom Preço" /> </div> <div class="mb-2.5 animate-[mo-stg_6s_cubic-bezier(.2,.8,.2,1)_infinite] [animation-delay:.3s]"> <.input label="CNPJ" placeholder="00.000.000/0000-00" /> </div> </div>
layout stacked/aside · columns 1/2/3
Aparecem nas notas fiscais.
Aparecem nas notas fiscais.
Aparecem nas notas fiscais.
<div class="flex flex-col gap-4.5"> <.form_section title="Dados da empresa" description="Aparecem nas notas fiscais." divider={false}> <.input label="Razão social" placeholder="Mercadinho Bom Preço" /> <.input label="CNPJ" placeholder="00.000.000/0000-00" /> </.form_section> <.form_section title="Dados da empresa" description="Aparecem nas notas fiscais." layout="aside" > <.input label="Razão social" placeholder="Mercadinho Bom Preço" /> <.input label="CNPJ" placeholder="00.000.000/0000-00" /> </.form_section> <.form_section title="Dados da empresa" description="Aparecem nas notas fiscais." columns={3} divider={false} > <.input label="Razão social" placeholder="Mercadinho Bom Preço" /> <.input label="CNPJ" placeholder="00.000.000/0000-00" /> <.input label="Inscrição estadual" placeholder="Isento" /> </.form_section> </div>
Uso
<.form_section title="Faturamento" description="…">…<:actions>…</:actions></.form_section>
Regras
- Ações ficam no rodapé à direita: primário por último.
- Uma seção por assunto; não misture cobrança e perfil.
Referência da API
Todos os function components, atributos, valores e slots que este componente cobre.
A group of fields under a small title, laid out in a grid.
<.form_section title="Contato">
<.input field={@form[:email]} label="E-mail" />
<.input field={@form[:phone]} label="Telefone" />
</.form_section>
<.form_section title="Endereco" description="Usado na NF-e" layout="aside" columns={3}>
<.input field={@form[:zip]} label="CEP" />
</.form_section>
stacked (default) puts the title over the fields and closes the section with a line
(divider={false} drops it); aside puts the title and description in a column at the left.
The fields go in columns columns (two by default). The :action slot sits at the right of a
stacked title.
<.form_section>
Renders a form section; the inner block is its fields.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
title (required) |
:string |
||
description |
:string |
nil |
|
layout |
:string |
"stacked" |
stacked, aside |
variant |
:string |
nil |
nil, stacked, aside - The same as layout; it wins when given. |
columns |
:integer |
2 |
1, 2, 3 |
divider |
:boolean |
nil |
On by default for stacked, off for aside. |
id |
:string |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:action>- At the right of a stacked title (a link, a toggle).<:inner_block>(required)