Modify the background color of the disabled checkbox in Vuetify

Check out this example where I found a disabled checkbox.

Is there a way to set a custom background color for the "on" and "off" states of a disabled checkbox?

Answer №1

Implement a dynamic disabled tag in your code, as shown below:

:disabled="disabledValue"

Next, you can include a dynamic class by following this example:

:class="getColourDisabled(disabledValue)"

Utilize a function like the one demonstrated here:

getColourDisabled(disabledValue) {
  if (disabledValue) {
    return "myColourClass1"
  else {
    return "myColourClass2"
  }
}

Apply CSS classes such as:

.myColourClass2 {
  background-color: #dedede !important;
}

Answer №2

The color theme of the checkbox icon is determined by this particular style:

.theme--light.v-input--selection-controls.v-input--is-disabled:not(.v-input--indeterminate)
.v-icon {
  color: rgba(0,0,0,.26) !important;
}

If you want to customize all checkboxes, simply duplicate that selector and set your own color using !important to overwrite the default theme:

.theme--light.v-input--selection-controls.v-input--is-disabled:not(.v-input--indeterminate)
.v-icon {
  color: rgba(128,5,5,.3) !important;
}

To specifically customize the unchecked disabled box (the "off disabled" state), include the selector for the icon name .mdi-checkbox-blank-outline:

.theme--light.v-input--selection-controls.v-input--is-disabled:not(.v-input--indeterminate)
.v-icon.mdi-checkbox-blank-outline {
  color: rgba(20,128,100,0.4) !important;
}

Check out the demo here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Customizing hover color with tailwind CSS

How can I change the color of an icon on mouseover using Tailwind CSS? I have tried to go from this to this , but it's not working. .btn { @apply agt-h-10 agt-w-10 agt-bg-zinc-100 agt-rounded-full agt-flex agt-justify-center } .img{ @apply agt ...

How can I make my modal box appear after someone clicks on selecting a college?

Can someone help me figure out how to display my modal box after clicking into the selecting list? I've already coded it, but I'm struggling with getting it to show up after the click event. Any assistance is appreciated! In the image provided, ...

Conditional statement in Javascript for document.cookie

I am attempting to create a basic if statement that relies on the value of a cookie. The function looks like this: function setHomePage() { if ($.cookie('settingOne') == 'jjj') { $('.secO').css('display', & ...

What is the best way to make a DIV box span the entire webpage without overflowing to the left?

I am currently working on a client's website and running into some issues with the layout of the booking page. The address is supposed to be on the left side, the contact form on the right, and both should be contained within a white box that fills th ...

The color of the SVG is not visible in the PNG rendition

I have applied a style to an svg image and successfully changed the fill color using a random colors function in JavaScript. However, when I convert the svg to a png format after making these color changes, the PNG file retains the original colors instead ...

Guide on resetting v-modelReady to learn how to reset

I am struggling with a toggle and reset button implementation: <template> <label :for='id + "_button"' :class='{"active": isActive}' class='toggle__button'> <input type='checkbox&ap ...

Looking for a resolution with NicEditor - Seeking advice on incorporating custom select options

I recently started using NICInline Editor and found a helpful sample at Is there a way to incorporate custom options into this editor? I would like the selected option's value to be inserted right at the cursor point of the Editor Instance. Query: H ...

What's the best way to navigate across by simply pressing a button located nearby?

Hey there! I'm new to JavaScript and I'm working on a shopping list page for practice. In my code, I can add new items to the list, but what I really want is to be able to cross out an item when I click the "Done" button next to it, and then uncr ...

Fetching values from dynamically generated elements in a Vue.js loop

I am currently working on creating a table that includes checkboxes and text fields based on an array of items, essentially building a "questionnaire" where the questions are pulled from a database. My question now is how can I efficiently retrieve inform ...

Prevent users from saving changes made to dropdown menu values (as well as other user-inputted content) using Inspect Element on the website before it

Recently, I started testing my website for bugs and stumbled upon a major issue that caught me by surprise. I never realized that changes made with Firebug or similar plugins on websites could actually be saved and implemented. Despite my efforts to preve ...

Can a phone without GPS capability still perform geocoding functions?

Is it possible to obtain the location through visiting a website? I am aware that HTML5 allows for this, but will it be compatible with mobile phones? ...

What is the best way to line up a Material icon and header text side by side?

Currently, I am developing a web-page using Angular Material. In my <mat-table>, I decided to include a <mat-icon> next to the header text. However, upon adding the mat-icon, I noticed that the icon and text were not perfectly aligned. The icon ...

What is the best method to transfer text entered in one textarea to the output of another?

I recently picked up JavaScript again and encountered an issue while developing an app. I am struggling to pass input from one textarea to another, where the text should be converted to uppercase. I attempted to tweak code from w3, but I prefer to achieve ...

JavaScript Loading Screen - Issues with window.onload functionality

I am currently working on creating a loading screen for my project. I need to use JavaScript to remove the CSS property "Display: none" from the page, but for some reason, my code is not functioning as expected. The Issue: I discovered that using window. ...

Choose the first element of its type and disregard any elements nested within it

I need to change the color of only the first p element within a specific div. Using :first-child would work in a simple example, but in my project, there are multiple elements and more could be added in the future. I want to avoid using :first-child alto ...

Discover the process of transitioning your animations from Angular to CSS

I have successfully implemented a fade-in/out animation using @angular/animation, but now I am looking to transfer this animation to CSS and eliminate the dependency on @angular/animation. Here is my current animation setup (triggering it with [@fadeInOut ...

What are the benefits of using CouchDB for login functionality, but encountering an empty CouchDB session while utilizing Vue.js and P

Utilizing Vusjs, pouchdb-browser, CouchDB, and pouchdb-authentication I am attempting to verify if a session is active for offline stay logged in. Upon logging in with db.logIn from pouchdb-authentication: response: {ok: true, name: "01HAYJ", ...

Navigating within an ionic framework

I am facing an issue with a simple form in my application. When I try to enter user details, the Android keyboard hides the email field and mobile number field, making it impossible for me to scroll the page upwards. Can anyone suggest a solution? <i ...

The presence of ng-show dynamically adjusts the minimum height of a div element

I am encountering an issue with a div that has the class of wrapper. Inside this div, there is a parent div with the class of content-wrapper. The wrapper div includes a conditional directive ng-show which toggles between displaying or hiding its content. ...

Expansive Child Division with Ample Margins

I'm currently working with a nested set of divs and I need the inner div to occupy the full width without extending beyond the parent div's margins. Despite trying to use max-width:100%, it hasn't been successful so far. For this particular ...