View Source PlausibleWeb.Live.Components.Form (Plausible v0.0.1)
Generic components stolen from mix phx.new templates
Summary
Functions
Generates a generic error message.
Renders an input with label and error messages.
Attributes
id
(:string
) (required)name
(:string
) (required)label
(:string
) - Defaults tonil
.value
(:string
) - Defaults to""
.- Global attributes are accepted.
Renders a label.
Attributes
id
(:any
) - Defaults tonil
.label
(:string
) - Defaults tonil
.field
(Phoenix.HTML.FormField
) (required) - a form field struct retrieved from the form, for example: @form[:password].strength
(:any
)- Global attributes are accepted. Supports all globals plus:
["autocomplete", "disabled", "form", "maxlength", "minlength", "readonly", "required", "size"]
.
Attributes
minimum
(:integer
) (required)class
(:any
)ok_class
(:any
)error_class
(:any
)field
(Phoenix.HTML.FormField
) (required) - a form field struct retrieved from the form, for example: @form[:password].
Attributes
score
(:integer
) - Defaults to0
.warning
(:string
) - Defaults to""
.suggestions
(:list
) - Defaults to[]
.
Functions
Generates a generic error message.
Slots
inner_block
(required)
Renders an input with label and error messages.
A Phoenix.HTML.FormField
may be passed as argument,
which is used to retrieve the input name, id, and values.
Otherwise all attributes may be passed explicitly.
Examples
<.input field={@form[:email]} type="email" /> <.input name="my-input" errors={["oh no!"]} />
Attributes
id
(:any
) - Defaults tonil
.name
(:any
)label
(:string
) - Defaults tonil
.help_text
(:string
) - Defaults tonil
.value
(:any
)width
(:string
) - Defaults to"w-full"
.type
(:string
) - Defaults to"text"
.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 to Phoenix.HTML.Form.options_for_select/2.multiple
(:boolean
) - the multiple flag for select inputs. Defaults tofalse
.class
(:any
) - Defaults to"text-sm dark:bg-gray-900 block pl-3.5 py-2.5 border-gray-300 dark:border-gray-500 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 rounded-md"
.mt?
(:boolean
) - Defaults totrue
.max_one_error
(:boolean
) - Defaults tofalse
.- Global attributes are accepted. Supports all globals plus:
["accept", "autocomplete", "capture", "cols", "disabled", "form", "list", "max", "maxlength", "min", "minlength", "multiple", "pattern", "placeholder", "readonly", "required", "rows", "size", "step", "x-model"]
.
Slots
inner_block
Attributes
id
(:string
) (required)name
(:string
) (required)label
(:string
) - Defaults tonil
.value
(:string
) - Defaults to""
.- Global attributes are accepted.
Renders a label.
Attributes
for
(:string
) - Defaults tonil
.class
(:string
) - Defaults to""
.
Slots
inner_block
(required)
Attributes
id
(:any
) - Defaults tonil
.label
(:string
) - Defaults tonil
.field
(Phoenix.HTML.FormField
) (required) - a form field struct retrieved from the form, for example: @form[:password].strength
(:any
)- Global attributes are accepted. Supports all globals plus:
["autocomplete", "disabled", "form", "maxlength", "minlength", "readonly", "required", "size"]
.
Attributes
minimum
(:integer
) (required)class
(:any
)ok_class
(:any
)error_class
(:any
)field
(Phoenix.HTML.FormField
) (required) - a form field struct retrieved from the form, for example: @form[:password].
Attributes
score
(:integer
) - Defaults to0
.warning
(:string
) - Defaults to""
.suggestions
(:list
) - Defaults to[]
.