-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a state field to create utility pseudo-classes #31643
Conversation
2e31c6d
to
2a7457b
Compare
personally, not a fan of bloating the CSS with these sorts of pervasive utility classes |
Hi I proceed from the fact that I have often seen and used such classes when creating sites. This is common since most designers like to use hover effects. For example, on the card component If necessary, they can not be generated, as is done by default. |
Not sure about this either. It has very low value without transition, and this would massively increase the file size when enabled. @twbs/css-review this (and other PR adding utilities out there) makes me wonder if we shouldn't publish our utility API as an external project —just like RFS— to allow anyone to easily build their own atomic CSS framework, and keep Bootstrap utilities in finer control. Any opinions? |
I'm ok with this PR since it's not disabled by default and could be useful in some cases.
When enabling I would personally not enable it on the rounded utilities, I can't think of any use cases for that. Also, this needs documentation.
I'm cool with that. The only downside is that we currently copy paste updates since we do not want to rely on package managers like npm. This could potentially be a PITA in the long run. |
@MartijnCuppens, thanks for the comment
Yes you are right. Submitted a new commit
Is this worth adding to the theming section of the documentation? |
Ok :). I added to the documentation for an example. Thanks |
If I come in handy in development, I am always ready to help |
FWIW my RTL branch extends the API a bit, to prevent some utilities from being generated in RTL output ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be pretty cool. Originally expected to be against this, but given it's opt-in, that seems like a powerful update for folks that want it. Leaving suggestions here that I'll batch merge after submitting this review to fix the typos.
Do we need any other controls here? Do we need a global option at all? Feels like we could skip that entirely and just have the option there for the API.
Thanks for fix the typos ❤️ |
@mdo Hi, Any news on this PR? |
@Psixodelik Would you be willing to revamp this to support multiple states that users could specify in a list? For example, |
@mdo Sure. Today I will refactor the code and add the ability to specify various pseudo-classes |
dcf91f0
to
c260945
Compare
@mdo Sorry, I forgot about your commit and made a force push. But everything changed there :D Maybe need squash commit? |
@MartijnCuppens anything to fix here? |
@mdo Mark, maybe add another transition field to the API? This will make hover and focus less sharp. It might look like this: $utilities: (
"shadow": (
property: box-shadow,
state: hover focus,
transition: 0.7s,
class: shadow,
values: (
null: $box-shadow,
sm: $box-shadow-sm,
lg: $box-shadow-lg,
none: none,
)
)
); CSS output: .shadow-sm {
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
transition: 0.7s;
} |
I don't think we need to add transitions. Utilities are inherently meant to be single property-value pairs. |
Does it support all [Pseudo-Classes](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes) I think that in Utilities map should make some simple changes something like this : remove the default responsive option and add it to states option to be like this :
|
Pushed some docs updates here to match the rest of the API page. Care to review @twbs/css-review? |
remome several hobers refactoring hover utilities refactoring hover utilities
543b652
to
5b0040a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work fine! I've rebased this PR and squashed some commits
Fixes #31639
Added state option for utilities. This will generate custom pseudo-classes when generating utilities.
Example
SCSS
CSS output