View Source Moon.Design.Form.Field.ErrorTag (Moon v2.89.1)

copy of Surface.Components.Form.ErrorTag

Properties

  • form :any, from_context: {Surface.Components.Form, :form} - An identifier for the form
  • field :any, from_context: {Surface.Components.Form.Field, :field} - An identifier for the associated field
  • class :css_class - Classes to apply to each error tag <span>.

This can also be set via config, for example:

config :surface, :components, [
  {Surface.Components.Form.ErrorTag, default_class: "invalid-feedback"}
]

However, the prop overrides the config value if provided.

  • translator :fun - A function that takes one argument {msg, opts} and returns the translated error message as a string. If not provided, falls back to Phoenix's default implementation.

This can also be set via config, for example:

config :surface, :components, [
  {Surface.Components.Form.ErrorTag, default_translator: {MyApp.Gettext, :translate_error}}
]

Summary

Functions

Callback implementation for Surface.Component.render/1.