Torch.Component (Torch v6.0.0)
View SourceProvides Phoenix.Components for use in Torch views and layouts
Summary
Functions
Returns a formatted group of all flash messages available.
Renders generic error message
Renders a simple flash message tag
Renders a Torch form input with label and error messages.
Renders a label
Translates an error message using gettext.
Translates the errors for a field from a keyword list of errors.
Functions
Returns a formatted group of all flash messages available.
Example
<.flash_messages flash={conn.assigns.flash} />Attributes
flash(:map)
Renders generic error message
Attributes
for(:string) - Defaults tonil.
Slots
inner_block(required)
Renders a simple flash message tag
Attributes
flash_type(:string)message(:string)
Renders a Torch form input with label and error messages.
A %Phoenix.HTML.Form{} (see Phoenix.HTML.Form) and field name may be
passed to the input to build input names and error messages, or all the
attributes and errors may be passed explicitly.
Examples
<.torch_input field={@form[:email]} type="email" />
<.torch_input name="my-input" errors={["oh no!"]} />Attributes
id(:any) - Defaults tonil.type(:string) - Defaults to"text". Must be one of"number","checkbox","textarea","date","datetime","time","datetime-local","select","text","string", or"file".value(:any)name(:any)label(:string) - Defaults tonil.field(Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].errors(:list) - Defaults to[].checked(:boolean) - the checked flag for checkbox inputs.prompt(:string) - the prompt for select inputs. Defaults tonil.options(:list) - the options to pass toPhoenix.HTML.Form.options_for_select/2.multiple(:boolean) - the multiple flag for select inputs. Defaults tofalse.- Global attributes are accepted. Supports all globals plus:
["autocomplete", "cols", "disabled", "form", "max", "maxlength", "min", "minlength", "pattern", "placeholder", "readonly", "required", "rows", "size", "step"].
Slots
inner_block
Renders a label
Attributes
for(:string) - Defaults tonil.
Slots
inner_block(required)
Translates an error message using gettext.
Translates the errors for a field from a keyword list of errors.