Form

Implement of form component. SaladUI doesn’t define its own form, but it provides a set of form-related components to help you build your own form.

Read more Read less

Reuse .form from live view Component, so we don’t have to duplicate it

Examples:

<div>
  <.form
    class="space-y-6"
    for={@form}
    id="project-form"
    phx-target={@myself}
    phx-change="validate"
    phx-submit="save"
  >
    <.form_item>
    <.form_label>What is your project's name?</.form_label>
    <.form_control>
        <Input.input field={@form[:name]} type="text" phx-debounce="500" />
      </.form_control>
      <.form_description>
          This is your public display name.
    </.form_description>
    <.form_message field={@form[:name]} />
    </.form_item>
    <div class="w-full flex flex-row-reverse">
      <.button
        class="btn btn-secondary btn-md"
        icon="inbox_arrow_down"
        phx-disable-with="Saving..."
      >
        Save project
        </.button>
    </div>
      </.form>
</div>

This is your public display name.

Attribute Type Documentation Default Value
class :string
rest :global
Required inner_block * :slot