View Source ZoonkWeb.Components.Form (Zoonk v0.3.0-alpha)

Form components.

Link to this section Summary

Functions

Renders a simple form.

Link to this section Functions

Renders a simple form.

examples

Examples

<.simple_form for={@form} phx-change="validate" phx-submit="save">
  <.input field={@form[:email]} label="Email"/>
  <.input field={@form[:username]} label="Username" />
  <:actions>
    <.button>Save</.button>
  </:actions>
</.simple_form>

attributes

Attributes

  • for (:any) (required) - the datastructure for the form.
  • as (:any) - the server side parameter to collect all input under. Defaults to nil.
  • title (:string) - the form title displayed before the form. Defaults to nil.
  • subtitle (:string) - the form subtitle displayed before the form. Defaults to nil.
  • class (:string) - the form class. Defaults to nil.
  • unstyled (:boolean) - whether to remove the default styling to the form. Defaults to false.
  • Global attributes are accepted.

slots

Slots

  • inner_block (required)
  • actions - the slot for form actions, such as a submit button.