PageHeader
A responsive header for your pages.
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>
<PPage>
<PPageHeader />
<PPageBody />
</PPage>
</template>
Title Soon
Use the title prop to display a title in the header.
PageHeader
<template>
<PPageHeader title="PageHeader" />
</template>The title is rendered as an
h1 by default. Use the as prop with an object to change it, for example :as="{ title: 'h2' }". You can also set the root element this way: :as="{ root: 'section', title: 'h2' }".Description
Use the description prop to display a description in the header.
PageHeader
A responsive page header with title, description and actions.
<template>
<PPageHeader
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.
Components
PageHeader
A responsive page header with title, description and actions.
<template>
<PPageHeader
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 Button in the header.
Components
PageHeader
A responsive page header with title, description and actions.
<script setup lang="ts">
import type { ButtonProps } from 'pohon-ui'
const links = ref<ButtonProps[]>([
{
label: 'GitHub',
icon: 'i-simple-icons-github',
to: 'https://github.com/vinicunca/pohon/tree/main/src/runtime/components/PageHeader.vue',
target: '_blank'
}
])
</script>
<template>
<PPageHeader
title="PageHeader"
description="A responsive page header with title, description and actions."
headline="Components"
:links="links"
/>
</template><script setup lang="ts">
import { ref } from 'vue'
import type { ButtonProps } from 'pohon-ui'
const links = ref<ButtonProps[]>([
{
label: 'GitHub',
icon: 'i-simple-icons-github',
to: 'https://github.com/vinicunca/pohon/tree/main/src/runtime/components/PageHeader.vue',
target: '_blank'
}
])
</script>
<template>
<PPageHeader
title="PageHeader"
description="A responsive page header with title, description and actions."
headline="Components"
:links="links"
/>
</template>Examples
While these examples use Nuxt Content, the components can be integrated with any content management system.
Within a page
Use the PageHeader component in a page to display the header 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>
<PPage>
<PPageHeader
:title="page.title"
:description="page.description"
:headline="page.headline"
:links="page.links"
/>
<PPageBody>
<ContentRenderer :value="page" />
<PSeparator />
<PContentSurround :surround="surround" />
</PPageBody>
<template #right>
<PContentToc :links="page.body.toc.links" />
</template>
</PPage>
</template>
API
Props
| Prop | Default | Type |
|---|---|---|
as | 'div' | anyThe element or component this component should render as. |
headline | string | |
title | string | |
description | string | |
links | ButtonProps[]Display a list of Button next to the title.
| |
ui | { root?: SlotClass; container?: SlotClass; wrapper?: SlotClass; headline?: SlotClass; title?: SlotClass; description?: SlotClass; links?: SlotClass; } |
Slots
| Slot | Type |
|---|---|
headline | {} |
title | {} |
description | {} |
links | {} |
default | {} |
Theme
app.config.ts
export default defineAppConfig({
ui: {
pageHeader: {
slots: {
root: 'relative border-b border-border py-8',
container: '',
wrapper: 'flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between',
headline: 'mb-2.5 text-sm font-600 color-primary flex items-center gap-1.5',
title: 'text-3xl sm:text-4xl text-pretty font-700 color-text-highlighted',
description: 'text-lg text-pretty color-text-muted',
links: 'flex flex-wrap items-center gap-1.5'
},
variants: {
title: {
true: {
description: 'mt-4'
}
}
}
}
}
})vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from 'pohon-ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
pageHeader: {
slots: {
root: 'relative border-b border-border py-8',
container: '',
wrapper: 'flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between',
headline: 'mb-2.5 text-sm font-600 color-primary flex items-center gap-1.5',
title: 'text-3xl sm:text-4xl text-pretty font-700 color-text-highlighted',
description: 'text-lg text-pretty color-text-muted',
links: 'flex flex-wrap items-center gap-1.5'
},
variants: {
title: {
true: {
description: 'mt-4'
}
}
}
}
}
})
]
})Changelog
No recent changes