BitstylesPhoenix.Error (bitstyles_phoenix v0.4.0) View Source
Component for showing UI errors.
Link to this section Summary
Link to this section Functions
Generates tag for inlined form input errors.
Uses the translate_errors
callback to translate field errors.
Generates tag for custom errors.
When errors are given in tuples {error, error_opts} they are given to the translate_errors
callback.
The error will be rendered with the warning color, as specified in bitstyles colors.
An error tag
iex> safe_to_string ui_error_tag("Foo error")
~s(<span class="u-fg--warning">Foo error</span>)
An error tag with a gettext tuple (processed by the default callback)
iex> safe_to_string ui_error_tag({"Foo error", count: 1})
~s(<span class="u-fg--warning">Foo error</span>)
An error tag with options
iex> safe_to_string ui_error_tag("Foo error", phx_feedback_for: "foo")
~s(<span class="u-fg--warning" phx-feedback-for="foo">Foo error</span>)