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

Issue with Bootstrap 4 toggle button functionality - looking for a fix

I'm encountering an issue with my website where the toggle button for the navbar is not functioning properly after I added it. Below is the code snippet for my navbar: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class=" ...

Ways to solve the issue of the mobile dropdown menu in Bootstrap

Check Out the Expected Look Here (Image link) See How it Appears on Mobile Devices The dropdown menu causes an increase in the size of the navbar on the mobile version. Below is the code snippet: <div style=" background-image: url(https://i.imgu ...

Guide for updating the background color, font color, and border color in Material UI's autocomplete textfield

How can I customize the appearance of this material-ui autocomplete textfield (combobox) by changing the background color, font color, and border color using CSS? Here is what I have attempted so far: <Autocomplete disablePortal id=" ...

Enhance user experience with jQuery UI sortable and the ability to edit content in real

I am facing an issue with jquery sortable and contenteditable. The problem arises when I try to use jquery sortable along with contenteditable, as the contenteditable feature stops working. After searching on Stack Overflow, I found a solution. However, up ...

Simultaneously updating pages and states with Vuex and Vue-router

I'm currently working on a single-page application that utilizes Vuex and Vue-router. Within my store, I have a large object - let's call it X - which is loaded from a database with an identifier. The Vue-router is used for navigation between th ...

Utilizing conditional statements like if/else and for loops within a switch statement in JavaScript allows for

I am currently developing a request portal that involves dynamic checkboxes, labels, and textboxes that are dependent on an option list. As a beginner in javascript, I am facing challenges with creating conditional statements. I have managed to make progr ...

"Troubleshooting: jQuery Find function not functioning correctly with HTML template

I am having trouble with a Shopify liquid code that I am trying to load into an HTML template <script type="text/template" id="description"> <div class="product-ddd"> {{ product.description }} </div> ...

Background image specifically for the Fullcalendar sun component

When setting a background image for Sunday in the month view, I noticed that the day "Sunday" in the header is also getting the same background. The CSS for the table thread has classes like .fc-sun and .fc-mon set as well, but I'm not sure how to rem ...

Struggling with pagination problems in Bootstrap 4 and looking to integrate QR code functionality into your blade template?

I am currently facing an issue with generating a batch of QR codes using the SimpleQR code generator in Laravel blade template on the fly for printing. The problem arises when a page break occurs, as it breaks the QR code. I attempted to use the break-insi ...

Guide on transitioning from a WebGL renderer to a canvas renderer in three.js

My goal is to display a scene using either a WebGL renderer or a canvas renderer in three.js (version 69). This is the code I am using: <!DOCTYPE html> <html> <head> <script src="./libs/three.js"></script> <scri ...

The content in the flex box item with horizontal scroll is overflowing beyond its boundaries

I am working with a flex box container that contains two child elements: a left side and a right side. I want the right side item to have a horizontal scrollbar in order to fit its content. .container { display: flex; overflow: hidden; height: 300 ...

Challenges with Setting up reCaptcha

Issue arises while trying to implement reCaptcha. In the body of my basic HTML page, I have a form with the following content. <form action="/cgi-bin/new_forms/form.pl" method="post" name="pledgeform" onSubmit="return validate(this)"> All form info ...

Performing two consecutive nested AJAX requests in jQuery using JavaScript

I am facing an issue with my code. My goal is to create a cryptocurrency ranking feature on my website. I have integrated an API that provides logos, symbols, indices, prices, etc. of cryptocurrencies. However, I encountered a problem as this API doesn&apo ...

I am currently attempting to design a blurred background with text overlay, where the text seems to clear up the blur effect of the background. However, I am facing

Goal: I want to achieve a visually appealing effect by overlaying text on a blurred background image, making it appear as though the text is transparent and revealing the clear background image behind it. Status: I have successfully created a layout with ...

Populate two b-form-select components with the same object by using the v-model directive in VueJS with BootstrapVue

I am trying to populate multiple select elements with the values from my "objectSelected" object, but for some reason it is not working within the bootstrap-vue form. There are no error messages displayed, it just simply does not load the values. //My sel ...

Empty Media Viewer

I am encountering an issue with setting up a code, as it only displays a blank white page. Any suggestions on what might be causing this problem in the setup and assistance in resolving it would be greatly appreciated. <script type="text/javascript ...

Trying to display logo using 'content' property in CSS

I've been trying to display a logo on the header of my website, but I'm having trouble getting it to show up. I attempted to set the logo using HTML syntax as well as the following CSS code: .div { content: url (...jpg); } However, both metho ...

Creating a Web Form in Outlook Using the POST Method

Seeking help in creating an HTML email featuring two interactive buttons - Approve and Reject. I have successfully generated the HTML email and sent it to Outlook. Snapshot: The HTML code within the email: <!DOCTYPE html> <html lang="en" xmlns ...

I require adding a new line of information into the database table

I am looking for help with adding data into a table without any user inputs. Specifically, I want to add data by passing them into an array and then be able to call them at the "Add Site" button so that the row is added into the table. Can someone assist m ...

The Vuejs Watch is leaping ahead by one tick

Currently, I am in the process of developing an application using Vuejs and Vuex. One of the Vuex modules that I have implemented is called settings_operations. Within this module, there is an action defined as follows: async changePassword ({ commit }, ...