페이지 섹션
페이지 섹션 (PageSection)
페이지에 사용하는 반응형 섹션 컴포넌트예요. 콘텐츠를 Container 안에 감싸면서도 전체 폭의 유연성을 유지해 배경색, 이미지, 패턴을 쉽게 추가할 수 있어요. 기본 슬롯에 일러스트레이션을 넣어 콘텐츠를 유연하게 표시하는 방법을 제공해요.
출처: Nuxt UI
본문
사용법 (Usage)
PageSection 컴포넌트는 콘텐츠를 Container 안에 감싸면서 전체 폭의 유연성을 유지해 배경색, 이미지, 패턴을 쉽게 추가할 수 있게 해 줘요. 기본 슬롯에 일러스트레이션을 넣어 콘텐츠를 유연하게 표시하는 방법을 제공해요.
<template>
<u-page-section :features="[
{
title: 'Icons',
description: 'Nuxt UI integrates with Nuxt Icon to access over 200,000+ icons from Iconify.',
icon: 'i-lucide-smile',
to: '/docs/getting-started/integrations/icons'
},
{
title: 'Fonts',
description: 'Nuxt UI integrates with Nuxt Fonts to provide plug-and-play font optimization.',
icon: 'i-lucide-a-large-small',
to: '/docs/getting-started/integrations/fonts'
},
{
title: 'Color Mode',
description: 'Nuxt UI integrates with Nuxt Color Mode to switch between light and dark.',
icon: 'i-lucide-sun-moon',
to: '/docs/getting-started/integrations/color-mode'
}
]" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." headline="Features" title="Beautiful Vue UI components" />
</template>
PageHero 컴포넌트 뒤에 사용할 수도 있어요.
<template>
<UPageHero />
<UPageSection />
</template>
제목 (Title)
title prop을 사용해 섹션의 제목을 설정해요.
<template>
<UPageSection title="Beautiful Vue UI components" />
</template>
설명 (Description)
description prop을 사용해 섹션의 설명을 설정해요.
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." />
</template>
헤드라인 (Headline)
headline prop을 사용해 섹션의 헤드라인을 설정해요.
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." headline="Features" />
</template>
아이콘 (Icon)
icon prop을 사용해 섹션의 아이콘을 설정해요.
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." icon="i-lucide-rocket" />
</template>
기능 (Features)
features prop을 사용해 설명 아래에 PageFeature 목록을 표시할 수 있어요. 다음 속성을 가진 객체 배열로 전달하면 돼요.
title?: stringdescription?: stringicon?: stringorientation?: 'horizontal' | 'vertical'
Link 컴포넌트의 to, target 등 어떤 속성이든 전달할 수 있어요.
<script setup lang="ts">
import type { PageFeatureProps } from '@nuxt/ui'
const features = ref<PageFeatureProps[]>([
{
title: "Icons",
description: "Nuxt UI integrates with Nuxt Icon to access over 200,000+ icons from Iconify.",
icon: "i-lucide-smile",
to: "/docs/getting-started/integrations/icons"
},
{
title: "Fonts",
description: "Nuxt UI integrates with Nuxt Fonts to provide plug-and-play font optimization.",
icon: "i-lucide-a-large-small",
to: "/docs/getting-started/integrations/fonts"
},
{
title: "Color Mode",
description: "Nuxt UI integrates with Nuxt Color Mode to switch between light and dark.",
icon: "i-lucide-sun-moon",
to: "/docs/getting-started/integrations/color-mode"
}
])
</script>
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." :features="features" />
</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",
color: "neutral"
},
{
label: "Explore components",
to: "/docs/components/app",
color: "neutral",
variant: "subtle",
trailingIcon: "i-lucide-arrow-right"
}
])
</script>
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." :links="links" />
</template>
방향 (Orientation)
orientation prop을 사용해 기본 슬롯과의 방향을 변경해요. 기본값은 vertical이에요.
<script setup lang="ts">
import type { PageFeatureProps, ButtonProps } from '@nuxt/ui'
const features = ref<PageFeatureProps[]>([
{
title: "Icons",
description: "Nuxt UI integrates with Nuxt Icon to access over 200,000+ icons from Iconify.",
icon: "i-lucide-smile",
to: "/docs/getting-started/integrations/icons"
},
{
title: "Fonts",
description: "Nuxt UI integrates with Nuxt Fonts to provide plug-and-play font optimization.",
icon: "i-lucide-a-large-small",
to: "/docs/getting-started/integrations/fonts"
},
{
title: "Color Mode",
description: "Nuxt UI integrates with Nuxt Color Mode to switch between light and dark.",
icon: "i-lucide-sun-moon",
to: "/docs/getting-started/integrations/color-mode"
}
])
const links = ref<ButtonProps[]>([
{
label: "Explore components",
to: "/docs/components/app",
color: "neutral",
variant: "subtle",
trailingIcon: "i-lucide-arrow-right"
}
])
</script>
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." icon="i-lucide-rocket" orientation="horizontal" :features="features" :links="links">
<img src="https://picsum.photos/704/1294" width="352" height="647" alt="Illustration" class="w-full rounded-lg" loading="lazy" />
</UPageSection>
</template>
반전 (Reverse)
reverse prop을 사용해 기본 슬롯의 방향을 반전시켜요.
<script setup lang="ts">
import type { PageFeatureProps, ButtonProps } from '@nuxt/ui'
const features = ref<PageFeatureProps[]>([
{
title: "Icons",
description: "Nuxt UI integrates with Nuxt Icon to access over 200,000+ icons from Iconify.",
icon: "i-lucide-smile",
to: "/docs/getting-started/integrations/icons"
},
{
title: "Fonts",
description: "Nuxt UI integrates with Nuxt Fonts to provide plug-and-play font optimization.",
icon: "i-lucide-a-large-small",
to: "/docs/getting-started/integrations/fonts"
},
{
title: "Color Mode",
description: "Nuxt UI integrates with Nuxt Color Mode to switch between light and dark.",
icon: "i-lucide-sun-moon",
to: "/docs/getting-started/integrations/color-mode"
}
])
const links = ref<ButtonProps[]>([
{
label: "Explore components",
to: "/docs/components/app",
color: "neutral",
variant: "subtle",
trailingIcon: "i-lucide-arrow-right"
}
])
</script>
<template>
<UPageSection title="Beautiful Vue UI components" description="Nuxt UI provides a comprehensive suite of components and utilities to help you build beautiful and accessible web applications with Vue and Nuxt." icon="i-lucide-rocket" orientation="horizontal" reverse :features="features" :links="links">
<img src="https://picsum.photos/704/1294" width="352" height="647" alt="Illustration" class="w-full rounded-lg" loading="lazy" />
</UPageSection>
</template>
API
Props
/**
* Props for the PageSection component
*/
interface PageSectionProps {
/**
* The element or component this component should render as.
* @default 'section'
*/
as?: any;
/**
* The headline displayed above the title.
*/
headline?: string | undefined;
/**
* The icon displayed above the title.
*/
icon?: any;
title?: string | undefined;
description?: string | undefined;
/**
* Display a list of Button under the description.
* `{ size: 'lg' }`{lang="ts-type"}
*/
links?: ButtonProps[] | undefined;
/**
* Display a list of PageFeature under the description.
*/
features?: PageFeatureProps[] | undefined;
/**
* The orientation of the section.
* @default 'vertical'
*/
orientation?: "vertical" | "horizontal" | undefined;
/**
* Reverse the order of the default slot.
* @default false
*/
reverse?: boolean | undefined;
ui?: { root?: SlotClass; container?: SlotClass; wrapper?: SlotClass; header?: SlotClass; leading?: SlotClass; leadingIcon?: SlotClass; headline?: SlotClass; title?: SlotClass; description?: SlotClass; body?: SlotClass; features?: SlotClass; footer?: SlotClass; links?: SlotClass; } | undefined;
}
Slots
/**
* Slots for the PageSection component
*/
interface PageSectionSlots {
top(): any;
header(): any;
leading(): any;
headline(): any;
title(): any;
description(): any;
body(): any;
features(): any;
footer(): any;
links(): any;
default(): any;
bottom(): any;
}
테마 (Theme)
export default defineAppConfig({
ui: {
pageSection: {
slots: {
root: 'relative isolate',
container: 'flex flex-col lg:grid py-16 sm:py-24 lg:py-32 gap-8 sm:gap-16',
wrapper: '',
header: '',
leading: 'flex items-center mb-6',
leadingIcon: 'size-10 shrink-0 text-primary',
headline: 'mb-3',
title: 'text-3xl sm:text-4xl lg:text-5xl text-pretty tracking-tight font-bold text-highlighted',
description: 'text-base sm:text-lg text-muted',
body: 'mt-8',
features: 'grid',
footer: 'mt-8',
links: 'flex flex-wrap gap-x-6 gap-y-3'
},
variants: {
orientation: {
horizontal: {
container: 'lg:grid-cols-2 lg:items-center',
description: 'text-pretty',
features: 'gap-4'
},
vertical: {
container: '',
headline: 'justify-center',
leading: 'justify-center',
title: 'text-center',
description: 'text-center text-balance',
links: 'justify-center',
features: 'sm:grid-cols-2 lg:grid-cols-3 gap-8'
}
},
reverse: {
true: {
wrapper: 'order-last'
}
},
headline: {
true: {
headline: 'font-semibold text-primary flex items-center gap-1.5'
}
},
title: {
true: {
description: 'mt-6'
}
},
description: {
true: ''
},
body: {
true: ''
}
},
compoundVariants: [
{
orientation: 'vertical',
title: true,
class: {
body: 'mt-16'
}
},
{
orientation: 'vertical',
description: true,
class: {
body: 'mt-16'
}
},
{
orientation: 'vertical',
body: true,
class: {
footer: 'mt-16'
}
}
]
}
}
})
변경 내역 (Changelog)
사이트맵 (Sitemap)
전체 사이트맵에서 모든 페이지를 확인할 수 있어요.