Breakpoints
Vuetify has a 12 point grid system. Built using flex-box, the grid is used to layout an application's content. It contains 5 types of media breakpoints that are used for targeting specific screen sizes or orientations. The props for grid components are actually classes that are derived from their defined properties. This allows you to easily specify these helper classes as props, while still providing the classes to be used anywhere.
Device | Code | Types | Range |
---|---|---|---|
phone_iphoneExtra small | xs | small to large handset | < 600px |
tabletSmall | sm | small to medium tablet | 600px > < 960px |
laptopMedium | md | large tablet to laptop | 960px > < 1264* |
desktop_windowsLarge | lg | desktop | 1264 > < 1904px* |
tvExtra large | xl | 4k and ultra-wides | > 1904px* |
* -16px on Desktop |
Breakpoint object
Vuetify converts the available breakpoints into an accessible object from within your application. This will allow you to assign/apply specific properties and attributes based upon viewport size. The object is available at $vuetify.breakpoint
.
This object contains the same semantic properties that you are already used to using from the grid system. Let's try a real world example. You have a v-dialog
component that you want to convert to a full-screen dialog on mobile devices. Normally you would need to bind watchers for the viewport size, and/or check whenever the page loads.
That's a lot of boilerplate to write. Even if you opt to use the built in v-resize directive, you are still going to have to define a resize method. With the breakpoint object you can completely skip this logic and get back to building your application.
Below you can see the complete definition of the $vuetify.breakpoint
object.
Customize the breakpoints
You can define your own breakpoint threshold pixel values, but it is currently a two-step process: 1. To update the styles you will have to override the $grid-breakpoints
stylus variables (please see Modifying Stylus variables). 2. To use the same values on the javascript side of things you must pass them during the application bootstrap like so: