Corex forms

From corex-ui/corex · View interactive version

Corex forms is an AI agent skill from the GitHub repository corex-ui/corex. Load when building Phoenix forms with to_form, phx-change validate, phx-submit, field={@form[:name]}, auto_invalid, controlled select/combobox/listbox, native_input checkbox select switch radio_group in lib/*_web/*_form_live.ex or *_form_live.ex, or when asked about Corex form inputs. Corex has no .

How to use this skill

Skill file

Corex forms

No <.form> component — Phoenix to_form/1 + Corex inputs with field={@form[:…]}.

Minimal profile form

<.form for={@form} id="profile-form" phx-change="validate" phx-submit="save">
  <.native_input field={@form[:name]} type="text" class="native-input">
    <:label>Name</:label>
  </.native_input>
  <.action type="submit" class="button ui-accent">Save</.action>
</.form>
def handle_event("validate", %{"profile" => params}, socket) do
  changeset = %Profile{} |> Profile.changeset(params) |> Map.put(:action, :validate)
  {:noreply, assign(socket, :form, to_form(changeset, action: :validate, as: :profile, id: "profile-form"))}
end

Pass auto_invalid on inputs when you want data-invalid borders from visible changeset errors. Form-bound select, combobox, and listbox need controlled with field={@form[:…]}.

Import matching CSS (native-input.css, etc.) and register hooks. MCP get_component for field attr on each input.

For {:array, :string} fields, use field :tags, {:array, :string} and either <.select multiple field={@form[:tags]} items={…}> (fixed options) or <.tags_input field={@form[:tags]}> (free-form). Both submit %{"tags" => ["a", "b"]} via name[]; do not use comma strings on :string fields.

Full checklist: sub-rule corex:forms.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.