Tips for adjusting breakpoints in the SCSS of Vuetify version 2?

I am currently using scss files and I want to adjust the breakpoints within the css code in vuetify version 2.

Unfortunately, I have not been able to locate any information regarding this in the vuetify upgrade guide.

In the previous version 1.5, I utilized style-x.styl for this purpose:

$grid-breakpoints := {
  xs: 0
  sm: 476px
  md: 668px
  lg: 1000px
  xl: 1300px
}
@import '~vuetify/src/styles/styles.sass';

$material-light.background = #f5f5f5;

@import '~vuetify/src/stylus/main';

After defining these styles, I proceed to import the file:

import '../style-x.styl';
...
Vue.use(Vuetify);
...

Answer №1

If you want to customize your Vuetify project, make sure to check out the documentation at https://vuetifyjs.com/en/customization/sass-variables/#vue-cli-install. According to the guidelines:

After installation, create a folder named sass, scss, or styles in the src directory with a file called variables.scss or variables.sass

Once you have created your project using Vue CLI, here is what you need to do manually:

  1. Create a new sass folder inside the src directory.
  2. In the newly created sass folder, add a file named variables.scss.
  3. In the variables.scss file, include the following lines which define the standard settings for bootstrap-4:

*

$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px
);
  1. Now restart npm run serve and your changes will be applied. Feel free to adjust the values in the $grid-breakpoints variable according to your needs.

Answer №2

To implement version 2.0, you must make changes to the SASS variables by creating a custom SASS file that you import into your vue.config.js file. You can find detailed instructions on how to do this at https://vuetifyjs.com/en/customization/sass-variables.

In order for the SASS variables to be accessible globally, follow these steps:

// src/sass/main.scss
@import '~vuetify/src/styles/styles.sass';

// Merge your new SASS variables with the existing ones
$grid-breakpoints: map-merge($grid-breakpoints, (
  xs: 0,
  sm: 476px,
  md: 668px,
  lg: 1000px,
  xl: 1300px
))

Next, ensure that your config file imports the variable globally:

// vue.config.js

module.exports = {
  css: {
    loaderOptions: {
      sass: {
        data: `@import "~@/sass/main.scss"`,
      },
    },
  },
}

Don't forget to define your custom breakpoints when setting Vuetify options as well: https://vuetifyjs.com/en/customization/breakpoints

// Import this into your main.js
import Vue from 'vue'
import Vuetify from 'vuetify/lib'

export default new Vuetify({
  breakpoint: {
    thresholds: {
       xs: 0,
       sm: 476,
       md: 668,
       lg: 1000,
       xl: 1300
    }
  }
})

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

What's the contrast between parameters and queries in the Vue router?

I'm currently struggling to understand the distinction between params and query in Vue Router. A recent situation has left me perplexed. There are two pages, A and B. I aim to navigate from page A to page B, where page B utilizes a dynamic route (e.g. ...

After clicking on the About page in Vue, my data seems to vanish into thin air

The Vue router is up and running with two pages: Home and About. Everything seems to be functioning properly, however, when I navigate to the About page and then return to the Home page, the data is lost. The page isn't refreshing, I'm simply swi ...

The HTML and CSS code I wrote functions perfectly on Codepen, but for some reason, it appears different when I view it in my Chrome environment

My codepen displays perfectly, but when I run the same code on my local environment it looks off. I can't seem to figure out what is causing the difference, especially since I copied and pasted the exact code. Both the codepen and my environment are u ...

"Troubleshooting an issue with post requests in VueJS and Laravel resulting in

Trying to execute a basic POST request using VueJS 2 (with axios) and Laravel 5.3, but encountering an issue where my method consistently returns an empty array when attempting to print $request->all(). The blade template includes the following meta ta ...

How can Vue.js transfer form data values (using v-model) from a Parent component to a Child component?

I am working on a multistep form using vue.js. The parent form collects two inputs and once these are validated, it moves to the next step which involves a child component. I want to pass the values from the parent component to the child component's f ...

Getting rid of unnecessary compiled CSS files in Compass

After making changes to files and running compass compile, the compiled files remain even if they are renamed or deleted. Similarly, compass clean does not remove these old files as it only focuses on cleaning up current files in use. I want to avoid compl ...

Creating a new array in Vue.js by filtering the results of a promise iteration

Is there a way to use the splice method to insert promise values from an old array into a new one for vue reactivity? I'm encountering an issue where the newArray remains empty and does not receive any values. Check out this link for more information. ...

Why am I unable to access the most up-to-date release of postcss?

I am currently utilizing vue-cli which relies on the presence of postcss. Upon executing npm audit, I am alerted about vulnerabilities within postcss and advised to upgrade to a newer version. How can I accomplish this task? I attempted using npm update, ...

Removing items in vue.js

I'm currently in the process of learning Vue.js. This is my first attempt at creating a small to-do application, and I am encountering issues with deleting each individual task upon clicking. Despite watching multiple YouTube tutorials, I have not bee ...

V-Stepper Slot Header in Vuetify 3 - Elevate Your Stepper

In the realm of creating a v-stepper in Vuetify 3, there exist two primary methods. One can either utilize the properties or delve into the template/slots. Personally, I encountered an issue with the properties method where the transition got all jumbled ...

Having trouble with integrating jsPlumb with Nuxtjs and encountering the error "document is not defined"?

I've seen some similar questions, but none of the solutions have worked for me so here's my issue. I'm attempting to integrate jsPlumb into my Nuxt.js/Vue.js application. Here are the steps I've taken: npm i jsplumb --save Create a ne ...

Rendering lists in Vuejs2 with computed properties for filtering

I'm struggling with list rendering and filtering data using computed properties. Instead of statically setting the row.age value, I want to filter based on filterKey. Any guidance on how to achieve this? I'm having trouble understanding it. He ...

Differences in React projects utilizing materialize-css compared to those using react-toolbox or material-ui

Is there a difference in technical benefits or code reliability when directly using material-css in JSX versus utilizing JSX specific libraries like material-ui or react-toolbox? Conversely, could using JSX libraries like material-ui or react-toolbox provi ...

What is the correct way to reset the styling of a web browser element, such as a <button>?

I have come across many sources advising me to reset HTML by manually resetting numerous individual properties, as demonstrated here: https://css-tricks.com/overriding-default-button-styles/ Another approach I discovered in CSS is simply using: button: {a ...

What steps should be taken to acquire the most recent CSS files for a theme?

We are facing an issue with implementing a versioning system for our CSS files. Currently, we append a build number to the CSS link programmatically (e.g. \themes\ssss\abc.css?1011) so that clients always receive the latest CSS files with ea ...

Develop your website layout with Flexbox (Bootstrap 4.2), using stacked grid designs similar to the float: left method

For my Wordpress theme, I am utilizing Bootstrap 4.2 to design a basic grid layout for a list of blog posts. In my design, I have a Card that is double the height of others and I am attempting to 'float' two single-height cards beside it. Previ ...

Personalized color scheme for calendar td

I am facing an issue with my event calendar where I want to change the background color of td. I came across a helpful solution in this question, but it did not fully solve my problem. When I implemented the following jquery: $('[class*="fc"]'). ...

What is the best way to add a gradient effect to my image? (link)

All the details are provided in this JSFiddle. Apologies, I am unable to display the link here. It can be found in the comments section! I'm facing difficulty achieving a red gradient over the image.. ...

navigating between html pages using sliding next and previous buttons

I am in the process of developing a multi-page form spread across 4 different pages. I would like to incorporate next and previous buttons to allow users to easily navigate through the form. Although I have tried looking online for solutions, most results ...

Struggling to eliminate the scrollbar on a Material UI Dialog

I have a modal window that includes a keyboard, but I'm encountering some issues. Despite adding overflow:'hidden' as inline CSS, the scrollbar refuses to disappear. Furthermore, even when utilizing container-full padding-0 in Bootstrap, th ...