defmodule Formulator do use Phoenix.HTML alias Formulator.HtmlError import Formulator.Input @doc """ Returns an html input with an associated label. If there are errors associated with the field, it will also output a span tag with the errors. ## Options * `:label` - When given a keyword list, the keyword `text` is extracted to use as the label text. All other options are passed along to the label. When given `false`, does not create a label tag. Instead, an `aria-label` attribute is added to the input to improve accessibility. * `:validate` - Defaults to application config. When provided a form created with an Ecto changeset that contains validations, then Formulator will add HTML5 validation attributes (except regex). * `:validate_regex` - Defaults to application config. Like option `:validate`, except this will add a pattern HTML5 validation. This should work with most simple regex patterns, but the browser's regex engine may differ from Erlang's. * `:wrapper_class` - This allows you to add a class to the div that wraps the input and label. This can also be set in your config: `config :formulator, wrapper_class: "input-wrapper"` ## Examples Basic input: <%= input form, :name %> #=>