LanternUI.Components.Form (LanternUI v0.3.2)

Copy Markdown View Source

Form chrome — label, error, and a Fluxon-compatible input.

<.input field={@form[:email]} label="Email" help_text="Used for billing." />
<.input name="q" value="" placeholder="Search…">
  <:inner_prefix><.icon name="magnifying-glass" /></:inner_prefix>
</.input>

input/1 mirrors Fluxon's surface: field (a Phoenix.HTML.FormField) or explicit name/value, plus label, sublabel, description, help_text, errors, size, and the four inner/outer_prefix/suffix slots. Styling is LanternUI's shadcn-density look; errors flip the border to danger and get announced via aria-describedby/aria-invalid.

Summary

Functions

error(assigns)

Attributes

  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

input(assigns)

Attributes

  • id (:any) - Defaults to nil.
  • label (:string) - Defaults to nil.
  • sublabel (:string) - Defaults to nil.
  • help_text (:string) - Defaults to nil.
  • description (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • size (:string) - Defaults to "md". Must be one of "xs", "sm", "md", "lg", or "xl".
  • disabled (:boolean) - Defaults to false.
  • field (Phoenix.HTML.FormField) - Defaults to nil.
  • value (:any) - Defaults to nil.
  • name (:any) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • type (:string) - Defaults to "text".
  • Global attributes are accepted. Supports all globals plus: ["placeholder", "autocomplete", "autofocus", "readonly", "required", "min", "max", "step", "minlength", "maxlength", "pattern", "inputmode", "list", "form"].

Slots

  • inner_prefix
  • outer_prefix
  • inner_suffix
  • outer_suffix

label(assigns)

Attributes

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

Slots

  • inner_block (required)