The pieces Ledger UI's forms are made of: a caption (label/1), a help line (help_text/1),
an error line (error/1) and the field/1 wrapper that puts them around any control.
<.label for="email">Email</.label>
<.help_text>We never share it.</.help_text>
<.error>can't be blank</.error>
<.field label="Country" help="Where you live" errors={@form[:country].errors}>
<select>…</select>
</.field>input/1, textarea/1, otp_input/1, phone_input/1 and the groups already render their own
field, so field/1 is for the controls Ledger UI does not draw (a native <select>, a
third-party widget).
Summary
Functions
A validation message in the small red text. It has role="alert".
Wraps a control with its caption, help line and errors.
The small line under a control. state="success" paints it green (with a check-circle icon)
and state="error" red.
A caption for the control with the id for.
Functions
A validation message in the small red text. It has role="alert".
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Wraps a control with its caption, help line and errors.
With as="label" (default) the whole block is a <label>, so a click on the caption focuses
the control. When there are errors they replace the help line.
Attributes
field(Phoenix.HTML.FormField) - Takes the errors from a form field. Defaults tonil.id(:string) - The id of the control, for the caption'sfor. Defaults tonil.label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.label_hint(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].state(:string) - Defaults tonil.Must be one ofnil,"","success", or"error".as(:string) - Defaults to"label". Must be one of"label", or"div".layout(:string) - Defaults to"stacked". Must be one of"stacked", or"inline".required(:boolean) - Adds the red asterisk to the caption. Defaults tofalse.label_id(:string) - Id of the caption (foraria-labelledby). Defaults tonil.msg_id(:string) - Id of the first help/error line (aria-describedby). Defaults tonil.class(:any) - Defaults tonil.bare(:boolean) - With nothing to show around the control (no caption, help, errors) render it alone. Defaults tofalse.- Global attributes are accepted.
Slots
aside- At the right of the help/error line (a character counter).below- Between the control and the help line (strength bars).inner_block(required)label_aside- At the right of the caption (a "Forgot?" link): the caption and this sit in alu-row.
The small line under a control. state="success" paints it green (with a check-circle icon)
and state="error" red.
Attributes
state(:string) - Defaults tonil.Must be one ofnil,"","success", or"error".class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
A caption for the control with the id for.
Attributes
for(:string) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)