0

I have the following:

<v-switch
  inset
  name="foo"
  label="foo"
  disabled
/>

and

<v-switch
  inset
  name="bar"
  label="bar"
  :readonly="true"
/>

In Vuetify 2, the disabled switch kept the primary color, but the readonly switch would be grey. I'm trying to get the same behavior on Vuetify 3.

If I do this:

.v-input--readonly .v-switch__track, .v-switch__thumb {
  color:rgb(var(--v-theme-primary))
}

Then that results in the readonly no longer being grey, which isn't what I want

But this makes all the switches the primary color:

.v-switch__track:not(.v-input--readonly), .v-switch__thumb:not(.v-input--readonly) {
  color:rgb(var(--v-theme-primary))
}

I've perused quite a few Stackoverflow posts and not managed to find anything that works. A few of those links, for reference: Change all read only fields background color in Vuetify Override disabled style on v-btn Set Styles for disabled Mat-Expansion Panel How to change/override the default color of a switch label in vuetify? How to change vuetify checkbox label style?

No combination of :not, :has, disabled, :disabled, aria-disabled, input[aria-disabled], input.aria-disabled, [aria-disabled=true], etc, seems to work. Possibly because of this: css :not(), selectors and selecting descendants

My best guess is the issue is that it's the VSelectionControl that actually has aria-disabled, but similar css tweaks with .v-selection-control haven't yielded fruit.

user3534080
  • 1,201
  • 1
  • 14
  • 21
  • On a related note, I'm struggling to style a disabled VTextField label without styling the input itself. The closest I've managed is `.v-field--disabled { opacity: .75; }`... it seems that in Vuetify 2, there was `.v-label--is-disabled` but I can't figure out the equivalent. `.v-text-field:deep(.v-field--disabled) .v-field-label { opacity: 0.75; }` doesn't work, either. – user3534080 Jun 06 '23 at 01:39

0 Answers0