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
inner_block Required

Explore Dizzy