Container

GitHub
A container lets you center and constrain the width of your content.

Usage

Use the default slot to center and constrain the width of your content.

Its max width is controlled by the --ui-container CSS variable.
<template>
  <UContainer>
    <Placeholder class="h-32" />
  </UContainer>
</template>

API

Props

Prop Default Type
as

'div'

any

The element or component this component should render as.

Slots

Slot Type
default

{}

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    container: {
      base: 'w-full max-w-(--ui-container) mx-auto px-4 sm:px-6 lg:px-8'
    }
  }
})
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({
      ui: {
        container: {
          base: 'w-full max-w-(--ui-container) mx-auto px-4 sm:px-6 lg:px-8'
        }
      }
    })
  ]
})

Changelog

5cb65 — feat: import @nuxt/ui-pro components

39c86 — fix: refactor types after @nuxt/module-builder upgrade (#3855)