PhxComponentHelpers.extend_class

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

extend_class(assigns, class_attribute_name \\ :class, default_classes)

View Source

Extends assigns with class attributes.

The class attribute will take provided default_classes as a default value and will be extended, on a class-by-class basis, by your assigns.

Parameters

  • assigns - your component assigns
  • class_attribute_name - the class attribute you want to define, :class by default
  • default_classes - the css classed that will put by default

Example

assigns
|> extend_class("bg-blue-500 mt-8")
|> extend_class(:wrapper_class, "py-4 px-2 divide-y-8 divide-gray-200")

assigns now contains @html_class and @html_wrapper_class.

If your input assigns were %{class: "mt-2", wrapper_class: "divide-none"} then:

  • @html_class would contain "bg-blue-500 mt-2"
  • @html_wrapper_class would contain "py-4 px-2 divide-none"