PageHeader
Usage
The PageHeader component displays a header for your page.
Use it inside the default slot of the Page component, before the PageBody component:
<template>
<UPage>
<UPageHeader />
<UPageBody />
</UPage>
</template>
Title
Use the title
prop to display a title in the header.
PageHeader
<template>
<UPageHeader title="PageHeader" />
</template>
Description
Use the description
prop to display a description in the header.
PageHeader
<template>
<UPageHeader
title="PageHeader"
description="A responsive page header with title, description and actions."
/>
</template>
Headline
Use the headline
prop to display a headline in the header.
PageHeader
<template>
<UPageHeader
title="PageHeader"
description="A responsive page header with title, description and actions."
headline="Components"
/>
</template>
Links
Use the links
prop to display a list of links in the header.
PageHeader
<template>
<UPageHeader
title="PageHeader"
description="A responsive page header with title, description and actions."
headline="Components"
:links="[
{
label: 'GitHub',
icon: 'i-simple-icons-github',
to: 'https://github.com/nuxt/ui-pro/tree/v3/src/runtime/components/PageHeader.vue',
target: '_blank'
}
]"
/>
</template>
Examples
Within a page
Use the PageHeader component in a page to display the header of the page:
<script setup lang="ts">
const route = useRoute()
definePageMeta({ layout: 'docs' })
const { data: page } = await useAsyncData(route.path, () => {
return queryCollection('content').path(route.path).first()
})
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
return queryCollectionItemSurroundings('content', route.path)
})
</script>
<template>
<UPage>
<UPageHeader
:title="page.title"
:description="page.description"
:headline="page.headline"
:links="page.links"
/>
<UPageBody>
<ContentRenderer :value="page" />
<USeparator />
<UContentSurround :surround="surround" />
</UPageBody>
<template #right>
<UContentToc :links="page.body.toc.links" />
</template>
</UPage>
</template>
API
Props
Prop | Default | Type |
---|---|---|
as |
|
The element or component this component should render as. |
headline |
| |
title |
| |
description |
| |
links |
Display a list of Buttons next to the title.
| |
ui |
|
Slots
Slot | Type |
---|---|
headline |
|
title |
|
description |
|
links |
|
default |
|
Theme
export default defineAppConfig({
uiPro: {
pageHeader: {
slots: {
root: 'relative border-b border-[var(--ui-border)] py-8',
container: '',
wrapper: 'flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4',
headline: 'mb-2.5 text-sm font-semibold text-[var(--ui-primary)] flex items-center gap-1.5',
title: 'text-3xl sm:text-4xl text-pretty font-bold text-[var(--ui-text-highlighted)]',
description: 'text-lg text-pretty text-[var(--ui-text-muted)]',
links: 'flex flex-wrap items-center gap-1.5'
},
variants: {
title: {
true: {
description: 'mt-4'
}
}
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
uiPro: {
pageHeader: {
slots: {
root: 'relative border-b border-[var(--ui-border)] py-8',
container: '',
wrapper: 'flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4',
headline: 'mb-2.5 text-sm font-semibold text-[var(--ui-primary)] flex items-center gap-1.5',
title: 'text-3xl sm:text-4xl text-pretty font-bold text-[var(--ui-text-highlighted)]',
description: 'text-lg text-pretty text-[var(--ui-text-muted)]',
links: 'flex flex-wrap items-center gap-1.5'
},
variants: {
title: {
true: {
description: 'mt-4'
}
}
}
}
}
})
]
})