mix ash_form.gen.form
(AshFormBuilder v0.4.0)
View Source
Generates a self-contained Phoenix LiveView (or LiveComponent) that renders
an AshFormBuilder.FormComponent wired to the given Ash resource.
Usage
$ mix ash_form.gen.form -r MyApp.Accounts.User
$ mix ash_form.gen.form -r MyApp.Accounts.User --action update
$ mix ash_form.gen.form -r MyApp.Accounts.User --out lib/my_app_web/live
$ mix ash_form.gen.form -r MyApp.Accounts.User --component
Required option
--resource/-r— Fully-qualified resource module (e.g.MyApp.Accounts.User).
Optional flags
--action/-a— Ash action to generate the form for (default:create).--out/-o— Output directory (default:lib/<otp_app>_web/live).--component/-c— Generate a LiveComponent instead of a LiveView.
Generated file
For a LiveView, the generated file calls the resource's
Resource.Form.for_<action> helper, renders the
AshFormBuilder.FormComponent, and handles the {:form_submitted, ...}
message sent on success.
For a LiveComponent, the generated file exposes an idiomatic update/2 +
render/1 pair ready to drop into a parent LiveView.