How can I fix the missing V-Checkbox icon in Vuetify using @mdi/js? Any suggestions for the best import method?

Can someone guide me on the proper utilization of Vuetify components that utilize icons with @mdi/js?

Here is my Vuetify configuration:

vuetify: {
  iconfont: 'mdiSvg',
  defaultAssets: false,
  ...
}

Although I can import the icons and customize them in the v-checkbox, I do not want to repeat this process for every v-checkbox used:

<template>
  <v-checkbox
    v-model="checkboxModel"
    :indeterminate-icon="mdiCheckboxMarkedOutline"
    :on-icon="mdiCheckboxMarked"
    :off-icon="mdiCheckboxBlankOutline"
    :label="Checkbox"
  ></v-checkbox>
</template>

<script>
import {
  mdiCheckboxBlankOutline,
  mdiCheckboxMarked,
  mdiCheckboxMarkedOutline,
} from '@mdi/js'

export default {
  data() {
    return {
      checkboxModel: false,
      mdiCheckboxBlankOutline,
      mdiCheckboxMarked,
      mdiCheckboxMarkedOutline,
    }
  },
}
</script>

Another approach would be to override the $checkboxOff SASS variable.

I located the declaration of the variable in

node_modules/vuetify/dist/vuetify.js
.

  checkboxOff: 'M19,3H5C3.89,3 3,3.89 3,5V19C3,20.1 3.9,21 5,21H19C20.1,21 21,20.1 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z',

This is the actual svg path of the icon (you can view it by pasting it into ). Despite attempting to override it in 'variable.scss', I have not achieved success.


What could be missing in my implementation?

Answer №1

It turned out the issue was due to my incorrect configuration settings. Here is the correct setup:

 vuetify: {
    icons: {
      iconfont: 'mdiSvg',
     }
  ...
}

Answer №2

Visit this link for more information about using custom icons in Vuetify

If you wish to define your own set of icons to be consistently used, you will need to adjust the 'values' setting in your Vuetify configuration when installing.

import {
  mdiCheckboxBlankOutline,
  mdiCheckboxMarked,
  mdiCheckboxMarkedOutline,
} from '@mdi/js'

// Customize Vuetify options:
{
  iconfont: 'mdiSvg',
  defaultAssets: false,
  values: {
    checkboxOn: mdiCheckboxMarked,
    checkboxOff: mdiCheckboxBlankOutline,
    checkboxIndeterminate: mdiCheckboxMarkedOutline,
  }
}

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

"The Vue component's data is successfully updating within a method using setInterval(), however, the changes are not reflected in the DOM

I have a function in my methods that gets triggered with a @click in the view. The function starts a timer, and although it seems to work fine in the DevTools, the timer only updates in the DevTools when I refresh the page. Moreover, in the view, the time ...

Incorporate a Vue directive based on a certain condition

Can a directive be set based on a condition? I have a directive called "sticky" that makes elements stick to the screen. I am currently using it in a social share component. <tempalte> <div class="social-share" v-sticky> .... ...

`How can I implement password protection for a single page using Vue.js?`

Currently working on a website using nuxtjs and curious if it's feasible to password protect a single page with vuejs instead of vanilla javascript. Is this achievable? If yes, then how? The objective is to restrict access to the webpage to only ind ...

Deploy a Vue.js application using Docker containerization technique

I am looking to dockerize my VueJS application. While I can successfully install and run my application on localhost using npm install and npm run serve commands on my local machine. To containerize the application, I have created a Dockerfile as follows: ...

Instructions for implementing a Gradient in Nuxt configuration for enabling dark mode in Vue

I'm currently working on my Nuxt config.js file and I want to implement a feature where the colors switch back and forth. However, when I try to apply the gradient class, it's not behaving as expected. Can someone please assist me with this issue ...

I need to generate table rows using v-for and include a unique value in the 'id' attribute of each row

I am creating table rows dynamically in a view using Flask data. <tr id="<% file.id %>" v-for="file in fileList"> <td><img class="thumbnail_preview" src=""></td> <td><% file.filename %></td> <td> ...

VueJS can manipulate an inline template by dynamically changing its content and reinitializing

this particular query shares similarities with the discussions on VueJS re-compiling HTML in an inline-template component as well as How to implement Vue js directive in an appended html element Regrettably, the approach suggested in those threads is no l ...

Two identical Vue component instances

Is there a way to duplicate a Vue component instance after mounting it with new DOM? I am currently working on coding a template builder and I need to clone some blocks. Similar to the duplicate feature on this website ...

Integration Between AppEngine and GitHub

Seeking assistance - encountering an issue with my Github account. It appears to be flagged and the files are not updating following commits. The trigger seems to be working correctly, but the actual files remain outdated. How can this problem be resolve ...

Creating a route-guard in a Vue.js/Firebase authentication system for secure navigation

I have created a Vue.js/Firebase authentication interface following a tutorial. The app is mostly functioning properly, but I am experiencing issues with the route guard. Upon signing in and redirecting from "http://localhost:8080/home" to "http://localh ...

The Vue Nuxt application returned an error when running npm dev because the new image file

Hey there, I recently added an image to the assets folder and after running npm run dev, my page is not displaying the image. You can check out the image https://i.stack.imgur.com/EczEy.png Here's my code: <div :style="{ backgroundImage: ...

Vue's drag-and-drop functionality is effective for dragging entire groups, but it does not work

Below is the code that enables dragging of groups in toListFetchRouteA1: <draggable id="first" data-source="juju" :list="toListFetchRouteA1" class="list-group" draggable=".item" group="a"> <div class="list-group-item item" v-for="teamfetch in ...

I'm having trouble launching the Vue UI after successfully installing the Vue CLI - any ideas why?

After installing the following versions: node 8.11.2 npm 6.3.0 I proceeded to install the Vue CLI (@vue/[email protected]): npm i -g @vue/cli However, upon running the command below: vue ui An error message was displayed as follows: Error: Cann ...

Display the verified user in a Vuejs interface

I followed a tutorial on Laravel 5.3 and Vue 2.0, but I'm encountering an issue: Link to Tutorial Video Products.vue: <my-product :key="product.id" v-for="product in products" :authenticatedUser="authenticatedUser" ...

Using Laravel with Vue and <router-link> does not update the content as expected

For my project, I am using Laravel with Vue. On the main page, I have listed all articles and when a user clicks on a specific article, a new page opens displaying that article with other prominent articles shown on the side like this: .https://i.stack.img ...

NuxtJS using Babel 7: the spread operator persists in compiled files

Struggling to get my NuxtJS app functioning properly on IE11. Despite multiple attempts to configure Babel for compatibility, spread operators are still present in the built pages files, suggesting that Nuxt code is not being transformed correctly. Below ...

An error occurred: gyp ERR! stack - The command `python -c import sys; print "%s.%s.%s" % sys.version_info[:3]` has failed

While attempting to npm install in a Vue project, I encountered an error even after running vue create (name): npm ERR! gyp verb check python checking for Python executable "c:\Python310\python.exe" in the PATH npm ERR! gyp verb `which` ...

Running a Vue.js application on your local machine and executing Cypress tests against it in sequence via an npm script'être

Recently, I have been faced with the challenge of setting up and running a local Vue.js app on localhost:3000 and then executing Cypress tests against it. Within my package.json file, I have included some npm scripts which are necessary for this process: ...

Issue with video.js text track memory leakage (WebVTT/VTT)

I am utilizing Video Text Tracks to showcase advanced live information on top of the video. A new video is loaded every few minutes, each with its own .webvtt file (consisting of 2-3k lines). Although everything is functioning properly, there is a persis ...

How to seamlessly integrate a filter into a Vue.js component

I am looking to ensure that a filter runs on a component every time it is used. While I know I can add a filter to a component in its markup, in this case the filter should be seen as essential or fundamental functionality of the component. For example, t ...