PUI.Components
(pui v1.0.0-beta.6)
Copy Markdown
Summary
Functions
Renders form field error messages.
Translates a form error tuple into a human-readable string.
Functions
Attributes
class(:string) - Defaults to"".variant(:string) - Defaults to"default". Must be one of"default","secondary","destructive", or"outline".
Slots
inner_block
Renders form field error messages.
Displays validation errors below form inputs. Renders nothing when errors is empty.
Examples
<.field_error errors={["can't be blank"]} />
<.field_error errors={["must be at least 3 characters", "is invalid"]} />
<.field_error errors={[]} />Attributes
errors(:list) - Defaults to[].
Attributes
min(:float) - Defaults to0.0.max(:float) - Defaults to100.0.value(:float) - Defaults to0.0.class(:string) - Defaults to"".
Translates a form error tuple into a human-readable string.
Error tuples from changesets have the form {msg, opts} where msg may contain
interpolation placeholders like %{count}.
Examples
iex> PUI.Components.translate_error({"can't be blank", []})
"can't be blank"
iex> PUI.Components.translate_error({"should be at least %{count} character(s)", [count: 3]})
"should be at least 3 character(s)"