You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Theming: update the utility attributes to use classes #480
What is missing or inaccurate about the content on this page?
Currently all of our theming documentation for css utilities is using the attribute styles, e.g.:
Why is this changed proposed? This will break all instances where I have text-center etc. It should be listed as a breaking change on the ionic 4 changelog.
We are removing the attribute documentation in favor of using the classes. As we add more utilities (see display) we will be adding them as classes only. The reason behind moving to classes is because in React, Stencil, or any framework using JSX and TypeScript there will be type errors thrown if you try to use a CSS attribute as it is looking for it to be a property of that element. Rather than have users use CSS attributes for certain frameworks and classes for others, we're recommending classes for consistency as they will work across frameworks without issue. Let me know if you have any questions, thanks!
Yes, we won't remove the attributes without a breaking change which requires a major version release (Ionic 5.x) but we are recommending classes for consistency. 🙂
@tmk1991 No worries! I understand the concern. It's definitely a goal of ours not to introduce any breaking changes moving forward without a major version, so I want to make sure that in cases like this that doesn't happen. 🙂
Activity
docs(layout): update the attributes to be classes
docs(layout): update the attributes to be classes (#482)
tmk1991 commentedon Mar 7, 2019
Why is this changed proposed? This will break all instances where I have text-center etc. It should be listed as a breaking change on the ionic 4 changelog.
brandyscarney commentedon Mar 8, 2019
@tmk1991 It is not a breaking change. The attributes are still there, this just removes them from the documentation and documents the class versions of the same attributes: https://github.com/ionic-team/ionic/blob/master/core/src/css/text-alignment.scss#L14-L15
We are removing the attribute documentation in favor of using the classes. As we add more utilities (see display) we will be adding them as classes only. The reason behind moving to classes is because in React, Stencil, or any framework using JSX and TypeScript there will be type errors thrown if you try to use a CSS attribute as it is looking for it to be a property of that element. Rather than have users use CSS attributes for certain frameworks and classes for others, we're recommending classes for consistency as they will work across frameworks without issue. Let me know if you have any questions, thanks!
tmk1991 commentedon Mar 8, 2019
So you're keeping the attributes it looks like:
.ion-text#{$infix}-center, [text#{$infix}-center] { text-align: center !important; }I panicked when I went into the docs and saw attributes removed from them.
brandyscarney commentedon Mar 8, 2019
Yes, we won't remove the attributes without a breaking change which requires a major version release (Ionic 5.x) but we are recommending classes for consistency. 🙂
tmk1991 commentedon Mar 8, 2019
Thanks @brandyscarney ! - Sorry if my original message came off as inflammatory. I should have investigated it more closely.
brandyscarney commentedon Mar 8, 2019
@tmk1991 No worries! I understand the concern. It's definitely a goal of ours not to introduce any breaking changes moving forward without a major version, so I want to make sure that in cases like this that doesn't happen. 🙂