Bootstrap: Add utility variants in the Utiliity API

Created on 9 Oct 2020  路  5Comments  路  Source: twbs/bootstrap

@mdo, it would be very helpful to have the possibility to choose whether we need variants for different utility classes inside the API. For example, we could add a transform or shadow property on hover, focus, and so on.

$utilities: (
   "opacity": (
      property: shadow,
      responsive: true,
      **variants: hover, focus**
      values: $shadow-values
   )
);

I think this is one feature that would make this cool API almost complete.

css feature

Most helpful comment

Yes, states is better

All 5 comments

There is a PR to do this https://github.com/twbs/bootstrap/pull/31643 , but I would prefer a different syntax than in that PR

E.g.
variants: hover, focus
or
variant: hover

Instead of
hover: true

Compared to variants, I think calling them something closer to what they are would be better. psuedo-classes might be too verbose and technical though, so maybe states? We use variants sometimes to describe the color schemes we provide on certain components.

Yes, states is better

I believe states is exactly what we need. Is there a chance to have it in alpha-3?

Added in Beta 1!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iklementiev picture iklementiev  路  3Comments

bellwood picture bellwood  路  3Comments

cvrebert picture cvrebert  路  3Comments

kamov picture kamov  路  3Comments

knownasilya picture knownasilya  路  3Comments