View Source LiveViewNative.LiveForm.Component (live_view_native_live_form v0.3.1)
Base components for LiveForm
Summary
Functions
Renders a form.
Functions
Renders a form.
This form component behaves identital to Phoenix.Component.form/1
. Please
refer to that docmentation for usage details. on arguments. This component
is platform agnostic. The <LiveForm>
element will be implemented in all
supported clients. Third-party clients can also implement their own <LiveForm>
element and take advantage of this component.
Attributes
for
(:any
) (required) - An existing form or the form source data.action
(:string
) - The action to submit the form on. This attribute must be given if you intend to submit the form to a URL without LiveView.as
(:atom
) - The prefix to be used in names and IDs generated by the form. For example, settingas: :user_params
means the parameters will be nested "user_params" in yourhandle_event
orconn.params["user_params"]
for regular HTTP requests. If you set this option, you must capture the form with:let
.csrf_token
(:any
) - A token to authenticate the validity of requests. One is automatically generated when an action is given and the method is notget
. When set tofalse
, no token is generated.errors
(:list
) - Use this to manually pass a keyword list of errors to the form. This option is useful when a regular map is given as the form source and it will make the errors available underf.errors
. If you set this option, you must capture the form with:let
.method
(:string
) - The HTTP method. It is only used if an:action
is given. If the method is notget
norpost
, an input tag with name_method
is generated alongside the form tag. If an:action
is given with no method, the method will default topost
.multipart
(:boolean
) - Setsenctype
tomultipart/form-data
. Required when uploading files.Defaults to
false
.Global attributes are accepted. Additional HTML attributes to add to the form tag. Supports all globals plus:
["autocomplete", "name", "rel", "enctype", "novalidate", "target"]
.
Slots
inner_block
(required) - The content rendered inside of the form tag.