Repository navigation
Formatting template overrides are not overriding defaults #2175
What happened?I am in the process of upgrading Freeform to v5 and am having to rework how we previously handled our custom formatting template work. I chose to use the method described in the documentation here where the overrides are defined when rendering the form: I have some Twig variables set with a list of classes and I am attempting to override the text input styles like so: When the form renders, I do see the classes I provided but they are mixed in (re-sorted?) with other conflicting Tailwind classes that I did not provide. This results in the form not having the desired styles. As a precaution, I even overrode the @global class attribute to be empty just in case it was global defaults being inserted into each field type as well. That didn't solve the issue. For the record, the default formatting template is set to Tailwind-3. How do I go about removing the unwanted classes from our form inputs, labels, containers, etc? Errors and Stack Trace (if available)How can we reproduce this?
Freeform EditionPro Freeform Version5.12.0 Craft Version4.14.15 When did this issue start?
Previous Freeform Version4.1.25 |
Replies: 2 comments 1 reply
|
Hi @benjaminkohl, You will want to have a look at the Behavior Syntax part of the documentation:
Essentially, if you want to override classes from elsewhere, you should do something like this: "@text": {
attributes: {
input: {
"=class": myClassesVariable,
},
label: {
"=class": myLabelClassesVariable,
},
}
},OR "@global": {
attributes: {
class: '',
label: {
"=class": standardLabelsClasses,
},
},
},Let me know if you have any further questions. 🙂 |
|
@kjmartens Oh, wow. Thanks! I guess I didn't make it that far down the page. |
Hi @benjaminkohl,
You will want to have a look at the Behavior Syntax part of the documentation:
https://docs.solspace.com/craft/freeform/v5/templates/formatting/#behavior-syntax