Main

A main element that fills the available viewport height.

Usage

The Main component works together with the Header component to create a full-height layout that extends to the viewport's available height.

The Header component defines its height through a --ui-header-height CSS variable, which you can customize by overriding it in your CSS.

Use the Main component in your app.vue or in a layout:

app.vue
<template>
  <UApp>
    <UHeader />

    <UMain>
      <NuxtLayout>
        <NuxtPage />
      </NuxtLayout>
    </UMain>

    <UFooter />
  </UApp>
</template>

API

Props

Prop Default Type
as

'main'

any

The element or component this component should render as.

Slots

Slot Type
default

{}

Theme

app.config.ts
export default defineAppConfig({
  uiPro: {
    main: {
      base: 'min-h-[calc(100vh-var(--ui-header-height))]'
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      uiPro: {
        main: {
          base: 'min-h-[calc(100vh-var(--ui-header-height))]'
        }
      }
    })
  ]
})