View Source DaisyUIComponents.Form (DaisyUIComponents v0.1.6)

Form component helpers

Summary

Functions

Generates a generic error message.

Renders an input with label and error messages.

Renders a label.

Functions

Generates a generic error message.

Attributes

  • show (:boolean) - Defaults to false.

Slots

  • inner_block (required)

Renders an input with label and error messages.

A %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

<.form_input field={@form[:email]} type="email" />
<.form_input name="my-input" errors={["oh no!"]} />

Attributes

  • id (:any) - Defaults to nil.
  • name (:any)
  • label (:string) - Defaults to nil.
  • value (:any)
  • type (:string) - Defaults to "text".
  • field (Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].
  • class (:string) - Defaults to nil.
  • bordered (:boolean) - Defaults to true.
  • errors (:list) - Defaults to [].
  • checked (:boolean) - the checked flag for checkbox inputs.
  • prompt (:string) - the prompt for select inputs. Defaults to nil.
  • options (:list) - the options to pass to Phoenix.HTML.Form.options_for_select/2.
  • multiple (:boolean) - the multiple flag for select inputs. Defaults to false.
  • Global attributes are accepted. Supports all globals plus: ["autocomplete", "cols", "disabled", "form", "list", "max", "maxlength", "min", "minlength", "pattern", "placeholder", "readonly", "required", "rows", "size", "step"].

Slots

  • inner_block

Renders a label.

Attributes

  • class (:any) - Defaults to nil.
  • for (:string) - Defaults to nil.
  • type (:string) - Defaults to "label".
  • label (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block