Usage
The PageBody component wraps your main content and adds some padding for consistent spacing.
Use it inside the default slot of the Page component, after the PageHeader component:
<template>
<B24Page>
<B24PageHeader />
<B24PageBody />
</B24Page>
</template>
Examples
While these examples use Nuxt Content, the components can be integrated with any content management system.
Within a page
Use the PageBody component in a page to display the content of the page:
pages/[...slug].vue
<script setup lang="ts">
const route = useRoute()
definePageMeta({
layout: 'docs'
})
const { data: page } = await useAsyncData(route.path, () => {
return queryCollection('docs').path(route.path).first()
})
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
return queryCollectionItemSurroundings('content', route.path)
})
</script>
<template>
<B24Page>
<B24PageHeader :title="page.title" :description="page.description" />
<B24PageBody>
<ContentRenderer :value="page" />
<B24Separator />
<B24ContentSurround :surround="surround" />
</B24PageBody>
<template #right>
<B24ContentToc :links="page.body.toc.links" />
</template>
</B24Page>
</template>
In this example, we use the
ContentRenderer component from @nuxt/content to render the content of the page.API
Props
Slots
Theme
app.config.ts
export default defineAppConfig({
b24ui: {
pageBody: {
base: 'mt-8 pb-24 space-y-12'
}
}
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'
export default defineConfig({
plugins: [
vue(),
bitrix24UIPluginVite({
b24ui: {
pageBody: {
base: 'mt-8 pb-24 space-y-12'
}
}
})
]
})