vuetify
vuetify copied to clipboard
[Bug Report][3.4.6] Disabling utility classes breaks some components blueprints and styling
Environment
Vuetify Version: 3.4.6 Vue Version: 3.3.11 Browsers: Chrome 120.0.0.0 OS: Mac OS 10.15.7
Steps to reproduce
- Clone https://github.com/mcfarljw/vuetify-disabled-class-utilities
- Run
npm i
- Run
npm run dev
Expected Behavior
Disabling utility classes doesn't break the default Vuetify components.
-
VBtn
should be rounded with a cursor on hover -
VTab
should use the correct colors with a cursor when hovering and be rounded -
VNavigationDrawer
should not have a border
Actual Behavior
Disabling utility classes cases several components to not be styled correctly.
-
VBtn
is not rounded without a cursor on hover -
VTab
is not the correct color when hovering and is not rounded -
VNavigationDrawer
has a border despite it being set to 0
Reproduction Link
https://github.com/mcfarljw/vuetify-disabled-class-utilities
Other comments
In general I've been having a lot of trouble following the documentation for SASS Variables (https://vuetifyjs.com/en/features/sass-variables). I'm trying to disable the utility classes so that I can use TailwindCSS, UnoCSS, or PandaCSS without conflicts but in this example I'm just trying to disable the utility classes without breaking the default styling based on the selected blueprint.
Utility classes disabled:
Utility classes enabled:
I don't think we can disable utility classes without side effect https://github.com/vuetifyjs/vuetify/discussions/12597#discussioncomment-6367854
@kingyue737 thanks for linking the discussion!
I realize it might not be easy/feasible to do but it would be nice if all components came bundled with required stylings based on the blueprint being used. As is mentioned in the linked thread TailwindCSS (or similar libraries like UnoCSS and PandaCSS) have become somewhat of a standard in terms of usage. They also come with VSCode extensions that provide a better developer experience. It seems like component libraries are embracing this like https://tailwind.primevue.org/ and which give developers the ability to mix and match without consequences.
Still love Vuetify more than other component libraries but at times it feels like utility classes are limited slightly different subset of more comprehensive existing styling solutions.
I have the same feeling. Using CSS utility classes is the worst DX I've experienced in Vuetify. No intellisense. I need to check the document each time I want to add a class. Not util at all.
I think I've got most of them memorized by now with the exception of needing to check d-flex
and the other flexbox classes. I know there is some VSCode extension that can be used to get basic autocomplete mentioned by someone of the core team but it's very basic.
I feel like most Vuetify specific things are prefixed with a "v" so doing the same with utility classes might actually avoid conflicts while also being more explicit:
-
text-h1
could bev-text-h1
-
rounded-xl
could bev-rounded-xl
-
justify-center
could bev-justify-center
@mcfarljw, I would suggest the opposite, i.e. the names of the available utility classes should follow Tailwind, just like e.g. UnoCSS does. Perhaps they could be a reasonable subset of what one can find there. I think that it could make sense for those who might want to use them.
That said, from my perspective utility classes go against the idea of CSS and are just a short form of writing inline styles
, hence they are something to potentially avoid and per my preference I would like to be able to completely disable them without any negative consequences.
As a side note, I would like to point out that the blueprints are faulty in some ways anyway and that they require some more love, e.g. in MD3 the button text should not use text-transform
to shout in UPPERCASE like in MD2, and also when I disable a button while using a dark theme I would expect it to be darker (less prominent) rather than lighter (more prominent).