mix ash_form.gen.crud (AshFormBuilder v0.4.0)

View Source

One-shot CRUD scaffold for an Ash resource.

Wraps mix ash_form.gen.live (Cinder data table + modal create/edit) and optionally mix ash_form.gen.form (one standalone form LiveView per declared form action) so a single command produces every page wired to AshFormBuilder.FormComponent.

The form pages are derived from the resource — for each forms do form :action do … end end declaration on the resource the task generates one <Resource>FormLive_<Action> LiveView. Adding/removing actions on the resource will reshape what the next regeneration produces.

Usage

$ mix ash_form.gen.crud -r MyApp.Accounts.User
$ mix ash_form.gen.crud -r MyApp.Blog.Post --accent teal --transitions smooth
$ mix ash_form.gen.crud -r MyApp.Inventory.Product --no-standalone-forms
$ mix ash_form.gen.crud -r MyApp.Accounts.User --actions create,update

Required option

  • --resource / -r — Fully-qualified resource module (e.g. MyApp.Accounts.User).

Optional flags

  • --out / -o — Output directory for the index LiveView. Default: lib/<otp_app>_web/live/<snake_resource>_live.
  • --page-size / -p — Cinder page size. Default: 25.
  • --theme / -t — Theme atom or module (:shadcn, :default, …).
  • --accent — Accent color atom (teal, indigo, rose, …).
  • --transitionsnone, subtle, or smooth.
  • --web-module — Override the <App>Web module name.
  • --actions — Comma-separated subset of actions to scaffold standalone form LiveViews for (default: every form declared by the resource).
  • --no-standalone-forms — Skip the per-action standalone form LiveViews; only generate the Cinder index page.

Generated files

  • index.ex and index.html.heex (via gen.live) — listing page with Cinder data table and an in-page modal for create/edit.
  • One <Resource>FormLive_<Action> standalone LiveView per declared action (via gen.form) — useful for routes that link to a dedicated form page rather than the index modal.

After generation the task prints router instructions for both the index page and any standalone form pages.