페이지 히어로
페이지 히어로 (PageHero)
PageHero는 페이지를 위한 반응형 히어로 섹션 컴포넌트예요. 콘텐츠를 Container 안에 감싸면서도 전체 너비 유연성을 유지해 배경색, 이미지, 패턴을 쉽게 넣을 수 있어요.
출처: Nuxt UI
본문
사용법 (Usage)
PageHero 컴포넌트는 전체 너비 유연성을 유지하면서 콘텐츠를 Container 안에 감싸줘서, 배경색이나 이미지, 패턴을 손쉽게 추가할 수 있게 해줘요. 기본 slot에 일러스트레이션과 함께 콘텐츠를 유연하게 표시할 수 있어요.
<template>
<u-page-hero description="A Nuxt/Vue-integrated UI library providing a rich set of fully-styled, accessible and highly customizable components for building modern web applications." title="Ultimate Vue UI library">
<u-page-card class="rounded-lg" variant="subtle">
<p>
<img alt="App screenshot" class="rounded-sm shadow-2xl ring ring-default" src="/blocks/image4.png" :height="540" :width="960" />
</p>
</u-page-card>
</u-page-hero>
</template>
제목 (Title)
title prop을 사용해 히어로의 제목을 설정할 수 있어요.
<template>
<UPageHero title="Ultimate Vue UI library" />
</template>
설명 (Description)
description prop을 사용해 히어로의 설명을 설정할 수 있어요.
<template>
<UPageHero title="Ultimate Vue UI library" description="A Nuxt/Vue-integrated UI library providing a rich set of fully-styled, accessible and highly customizable components for building modern web applications." />
</template>
헤드라인 (Headline)
headline prop을 사용해 히어로의 헤드라인을 설정할 수 있어요.
<template>
<UPageHero title="Ultimate Vue UI library" description="A Nuxt/Vue-integrated UI library providing a rich set of fully-styled, accessible and highly customizable components for building modern web applications." headline="New release" />
</template>
링크 (Links)
links prop을 사용해 설명 아래에 Button 목록을 표시할 수 있어요.
<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'
const links = ref<ButtonProps[]>([
{
label: "Get started",
to: "/docs/getting-started",
icon: "i-lucide-square-play"
},
{
label: "Learn more",
to: "/docs/getting-started/theme/design-system",
color: "neutral",
variant: "subtle",
trailingIcon: "i-lucide-arrow-right"
}
])
</script>
<template>
<UPageHero title="Ultimate Vue UI library" description="A Nuxt/Vue-integrated UI library providing a rich set of fully-styled, accessible and highly customizable components for building modern web applications." :links="links" />
</template>
방향 (Orientation)
orientation prop을 사용해 기본 slot의 방향을 바꿀 수 있어요. 기본값은 vertical이에요.
<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'
const links = ref<ButtonProps[]>([
{
label: "Get started",
to: "/docs/getting-started",
icon: "i-lucide-square-play"
},
{
label: "Learn more",
to: "/docs/getting-started/theme/design-system",
color: "neutral",
variant: "subtle",
trailingIcon: "i-lucide-arrow-right"
}
])
</script>
<template>
<UPageHero title="Ultimate Vue UI library" description="A Nuxt/Vue-integrated UI library providing a rich set of fully-styled, accessible and highly customizable components for building modern web applications." headline="New release" orientation="horizontal" :links="links">
<img src="/blocks/image4.png" alt="App screenshot" class="rounded-lg shadow-2xl ring ring-default" />
</UPageHero>
</template>
뒤집기 (Reverse)
reverse prop을 사용해 기본 slot의 방향을 뒤집을 수 있어요.
<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'
const links = ref<ButtonProps[]>([
{
label: "Get started",
to: "/docs/getting-started",
icon: "i-lucide-square-play"
},
{
label: "Learn more",
to: "/docs/getting-started/theme/design-system",
color: "neutral",
variant: "subtle",
trailingIcon: "i-lucide-arrow-right"
}
])
</script>
<template>
<UPageHero title="Ultimate Vue UI library" description="A Nuxt/Vue-integrated UI library providing a rich set of fully-styled, accessible and highly customizable components for building modern web applications." headline="New release" orientation="horizontal" reverse :links="links">
<img src="/blocks/image4.png" alt="App screenshot" class="rounded-lg shadow-2xl ring ring-default" />
</UPageHero>
</template>
API
Props
/**
* Props for the PageHero component
*/
interface PageHeroProps {
/**
* The element or component this component should render as.
* @default 'div'
*/
as?: any;
headline?: string | undefined;
title?: string | undefined;
description?: string | undefined;
/**
* Display a list of Button under the description.
* `{ size: 'xl' }`{lang="ts-type"}
*/
links?: ButtonProps[] | undefined;
/**
* The orientation of the page hero.
* @default 'vertical'
*/
orientation?: "horizontal" | "vertical" | undefined;
/**
* Reverse the order of the default slot.
* @default false
*/
reverse?: boolean | undefined;
ui?: { root?: SlotClass; container?: SlotClass; wrapper?: SlotClass; header?: SlotClass; headline?: SlotClass; title?: SlotClass; description?: SlotClass; body?: SlotClass; footer?: SlotClass; links?: SlotClass; } | undefined;
}
Slots
/**
* Slots for the PageHero component
*/
interface PageHeroSlots {
top(): any;
header(): any;
headline(): any;
title(): any;
description(): any;
body(): any;
footer(): any;
links(): any;
default(): any;
bottom(): any;
}
테마 (Theme)
export default defineAppConfig({
ui: {
pageHero: {
slots: {
root: 'relative isolate',
container: 'flex flex-col lg:grid py-24 sm:py-32 lg:py-40 gap-16 sm:gap-y-24',
wrapper: '',
header: '',
headline: 'mb-4',
title: 'text-5xl sm:text-7xl text-pretty tracking-tight font-bold text-highlighted',
description: 'text-lg sm:text-xl/8 text-muted',
body: 'mt-10',
footer: 'mt-10',
links: 'flex flex-wrap gap-x-6 gap-y-3'
},
variants: {
orientation: {
horizontal: {
container: 'lg:grid-cols-2 lg:items-center',
description: 'text-pretty'
},
vertical: {
container: '',
headline: 'justify-center',
wrapper: 'text-center',
description: 'text-balance',
links: 'justify-center'
}
},
reverse: {
true: {
wrapper: 'order-last'
}
},
headline: {
true: {
headline: 'font-semibold text-primary flex items-center gap-1.5'
}
},
title: {
true: {
description: 'mt-6'
}
}
}
}
}
})