Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do breakpoints in scss file with vuetify?

How to use media query breakpoints in my vuetify application but in scss file?

For example bootstrap enable me to do that in scss file:

@include media-breakpoint-up(sm) {
  .custom-class {
    display: block;
  }
}

what is the equivalent in vuetify? I can't find any documention in vuetify website

like image 900
Jon Sud Avatar asked May 03 '19 04:05

Jon Sud


People also ask

How do I use SASS variables in Vuetify?

Vue CLI install Once installed, create a folder called sass , scss or styles in your src directory with a file named variables. scss or variables. sass . The vuetify-loader will automatically bootstrap your variables into Vue CLI's compilation process, overwriting the framework defaults.

What is V Flex Vuetify?

Vuetify Flex Align Content. Vuetify provides flex align content classes that we can use to set the align-content CSS property of the flex container. The align-content modifies the flexbox items on the x-axis or y-axis for a flex-direction of row or column respectively.

Is Vuetify responsive?

With the VuetifyJs grid system, you can create very powerful responsive layouts without any line of JavaScript code.


2 Answers

I achieved this by attaching a class name corresponding to the breakpoint, which is available in the $vuetify.breakpoint object. Not a perfect solution, but I only needed to do it for once element in my app. Hope it helps!

Example:

<item :class="($vuetify.breakpoint.smAndDown) ? 'sm' : ''"></item>
...
<style scoped lang="scss">
#item{
    right: 130px;
    &.sm{
        right: 35px;
    }
}
</style>
like image 116
M Wuori Avatar answered Sep 20 '22 13:09

M Wuori


You can do it in scss:

@import '~vuetify/src/styles/settings/_variables';

@media #{map-get($display-breakpoints, 'sm-and-down')} {
    .custom-class {
        display: block;
    }
}

... and you're right there is very little docs regarding breakpoints within vuetify

like image 29
Claudiu Avatar answered Sep 20 '22 13:09

Claudiu