Form

New

Overview

A wrapper around Phoenix.Component.form, with a little bit of styling and a requirement for id.

HEEx
<Form.form
  for={@project_form}
  id="example-project-form"
  class="example-fields mx-auto w-full max-w-92.5"
>
  <Input.input field={@project_form[:name]} label="Project name" placeholder="New website" />
  <Textarea.textarea
    field={@project_form[:description]}
    label="Description"
    placeholder="Describe the project..."
  />
  <Button.button type={:submit}>Create project</Button.button>
</Form.form>

Add this module

terminal
mix dizzy.add form

Component API

Form.form

Attributes

Attributes for Form.form
NameTypeDefault Values
action :string nil โ€”
as :atom nil โ€”
class :any nil โ€”
csrf_token :any nil โ€”
errors :list nil โ€”
for :any Required โ€”
id :string Required โ€”
method :string nil โ€”
multipart :boolean false โ€”
rest :global nil โ€”

Slots

Slots for Form.form
NameRequired Attributes
inner_block Required โ€”