PhxComponentHelpers.forward_assigns

You're seeing just the function forward_assigns, go back to PhxComponentHelpers module for more information.
Link to this function

forward_assigns(assigns, opts)

View Source

Forward and filter assigns to sub components. By default it doesn't forward anything unless you provide it with any combination of the options described below.

Parameters

  • assigns - your component assigns

Options

  • prefix - will only forward assigns prefixed by the given prefix. Forwarded assign key will no longer have the prefix
  • take- is a list of key (without prefix) that will be picked from assigns to be forwarded
  • merge- takes a map that will be merged as-is to the output assigns

If both options are given at the same time, the resulting assigns will be the union of the two.

Example

Following will forward an assign map containing %{button_id: 42, button_label: "label", phx_click: "save"} as %{id: 42, label: "label", phx_click: "save"}

forward_assigns(assigns, prefix: :button, take: [:phx_click])