Skip to content

Configured at compile time via the src/styles/variables/_grid.scss file.

Breakpoints ​

The grid ships with five predefined breakpoints. All breakpoints are mobile-first (min-width): a rule set at md applies from 672 px upward and is inherited by lg, xl, and xxl unless overridden.

NameMin-width
sm320px
md672px
lg1056px
xl1312px
xxl1584px

TIP

These breakpoint names are important because you use them as keys in responsive prop objects. They can be overridden in src/styles/variables/_breakpoints.scss or by replacing the $breakpoints map.

An image

Columns and Gap ​

Columns default to 16. The gap system uses an 8px base unit with a named scale:

NameValue
xxs2px
xs4px
sm8px
md16px
lg24px
xl32px
xxl48px

TIP

Gap tokens are configured in src/styles/variables/_grid.scss via the $gap-ratios map.

Visual Demo ​

Refs ​

To get the underlying DOM element from a nb-grid, use the getRef() method it exposes — the component ref itself points to the Vue instance, not the element.

vue
<template>
  <nb-grid ref="myComponent"> test </nb-grid>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const myComponent = ref()

console.log(myComponent.value) 
console.log(myComponent.value.getRef()) 
</script>