BitstylesPhoenix.Component.Error.ui_error
You're seeing just the function
ui_error
, go back to BitstylesPhoenix.Component.Error module for more information.
Generates tag for custom errors.
Attributes
error
(required) - The error to render (expected to be a tuple with{message :: String.t(), opts :: keyword()}
).- All other attributes are passed to the outer
span
tag.
Uses the translate_errors
MFA from the config to translate field errors (e.g. with gettext
).
The error will be rendered with the warning color, as specified in bitstyles colors.
An error tag
iex> assigns = %{}
...> render ~H"""
...> <.ui_error error={{"Foo error", []}} />
...> """
"""
<span class="u-fg-warning">
Foo error
</span>
"""
An error tag extra options and classes
iex> assigns = %{error: {"Foo error", []}}
...> render ~H"""
...> <.ui_error error={@error} phx-feedback-for="foo" class="bar" />
...> """
"""
<span class="u-fg-warning bar" phx-feedback-for="foo">
Foo error
</span>
"""