LedgerUI.Components.FormSection (LedgerUI v0.2.0)

Copy Markdown View Source

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.

Summary

Functions

Renders a form section; the inner block is its fields.

Functions

form_section(assigns)

Renders a form section; the inner block is its fields.

Attributes

  • title (:string) (required)
  • description (:string) - Defaults to nil.
  • layout (:string) - Defaults to "stacked". Must be one of "stacked", or "aside".
  • variant (:string) - The same as layout; it wins when given. Defaults to nil. Must be one of nil, "stacked", or "aside".
  • columns (:integer) - Defaults to 2. Must be one of 1, 2, or 3.
  • divider (:boolean) - On by default for stacked, off for aside. Defaults to nil.
  • id (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • action - At the right of a stacked title (a link, a toggle).
  • inner_block (required)