attr :id, :any,
default: nil,
doc: "the id of the input. If not passed, it will be generated automatically from the field"
attr :name, :any,
doc: "the name of the input. If not passed, it will be generated automatically from the field"
attr :label, :string,
doc:
"the label for the input. If not passed, it will be generated automatically from the field"
attr :value, :any,
doc:
"the value of the input. If not passed, it will be generated automatically from the field"
attr :type, :string,
default: "text",
values:
~w(checkbox checkbox-group color date datetime-local email file hidden month number password
range radio-group radio-card search select switch tel text textarea time url week),
doc: "the type of input"
attr :size, :string,
default: "md",
values: ~w(xs sm md lg xl),
doc: "the size of the switch (xs, sm, md, lg or xl) or radio card (sm, md or lg)"
attr :variant, :any, default: "outline", doc: "outline, classic - used by radio-card"
attr :viewable, :boolean,
default: false,
doc: "If true, adds a toggle to show/hide the password text"
attr :copyable, :boolean,
default: false,
doc: "If true, adds a copy button to the field and disables the input"
attr :clearable, :boolean,
default: false,
doc: "If true, adds a clear button to clear the field value"
attr :field, Phoenix.HTML.FormField,
doc: "a form field struct retrieved from the form, for example: @form[:email]"
attr :errors, :list,
default: [],
doc:
"a list of errors to display. If not passed, it will be generated automatically from the field. Format is a list of strings."
attr :checked, :any, doc: "the checked flag for checkboxes and checkbox groups"
attr :prompt, :string, default: nil, doc: "the prompt for select inputs"
attr :options, :list, doc: "the options to pass to Phoenix.HTML.Form.options_for_select/2"
attr :multiple, :boolean, default: false, doc: "the multiple flag for select inputs"
attr :disabled_options, :list, default: [], doc: "the options to disable in a checkbox group"
attr :group_layout, :string,
values: ["row", "col"],
default: "row",
doc: "the layout of the inputs in a group (checkbox-group or radio-group)"
attr :empty_message, :string,
default: nil,
doc:
"the message to display when there are no options available, for checkbox-group or radio-group"
attr :rows, :string, default: "4", doc: "rows for textarea"
attr :class, :any, default: nil, doc: "the class to add to the input"
attr :wrapper_class, :any, default: nil, doc: "the wrapper div classes"
attr :help_text, :string, default: nil, doc: "context/help for your field"
attr :label_class, :any, default: nil, doc: "extra CSS for your label"
attr :selected, :any, default: nil, doc: "the selected value for select inputs"
attr :required, :boolean,
default: false,
doc: "is this field required? is passed to the input and adds an asterisk next to the label"
attr :rest, :global,
include:
~w(autocomplete autocorrect autocapitalize disabled form max maxlength min minlength list
pattern placeholder readonly required size step value name multiple prompt default year month day hour minute second builder options layout cols rows wrap checked accept),
doc: "All other props go on the input"