PhxComponentHelpers.extend_class
You're seeing just the function
extend_class
, go back to PhxComponentHelpers module for more information.
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 assignsdefault_classes
- the default classes that will be overridden by your assigns.
Options
:into
- put all css classes into this assign:error_class
- extra class that will be added if assigns contain form/field keys and field is faulty.
Example
assigns
|> extend_class("bg-blue-500 mt-8")
|> extend_class("py-4 px-2 divide-y-8 divide-gray-200", into: :wrapper_class)
|> extend_class("form-input", error_class: "form-input-error", into: :input_class)
assigns
now contains @raw_class
and @raw_wrapper_class
.
If your input assigns were %{class: "mt-2", wrapper_class: "divide-none"}
then:
@raw_class
would contain"bg-blue-500 mt-2"
@raw_wrapper_class
would contain"py-4 px-2 divide-none"