본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

PageCTA

원문 보기 위키 갱신

페이지에 표시하는 콜 투 액션(Call to Action) 섹션 컴포넌트예요. 기본 슬롯에 일러스트레이션을 넣어 다양한 방향과 스타일로 구성할 수 있어요.

출처: Nuxt UI

본문

페이지에 표시하는 콜 투 액션 섹션이에요.

사용법

PageCTA 컴포넌트는 기본(default) 슬롯에 일러스트레이션을 넣어 페이지에서 유연하게 콜 투 액션을 표시할 수 있는 방법을 제공해요.

<template>
  <u-page-c-t-a :links="[
    {
      label: 'Get started',
      color: 'neutral'
    },
    {
      label: 'Learn more',
      color: 'neutral',
      variant: 'subtle',
      trailingIcon: 'i-lucide-arrow-right'
    }
  ]" description="Preview the latest Tailwind CSS and get started with Nuxt UI." orientation="horizontal" title="Trusted and supported by our amazing community">
    <img alt="Illustration" class="w-full rounded-lg" :height="308" src="https://picsum.photos/640/616" :width="320" />
  </u-page-c-t-a>
</template>

PageSection 컴포넌트 안에서 쓰거나 페이지에 직접 사용할 수 있어요:

<template>
  <UPageHero />

  <UPageCTA class="rounded-none" />

  <UPageSection />

  <UPageSection :ui="{ container: 'px-0' }">
    <UPageCTA class="rounded-none sm:rounded-xl" />
  </UPageSection>

  <UPageSection />
</template>

[!TIP]

Use px-0 and rounded-none classes to make the CTA fill the edge of the page on mobile.

px-0과 rounded-none 클래스를 사용하면 모바일에서 CTA가 페이지의 가장자리를 꽉 채우게 만들 수 있어요.

타이틀 (Title)

title prop으로 CTA의 제목을 설정할 수 있어요.

<template>
  <UPageCTA title="Trusted and supported by our amazing community" />
</template>

설명 (Description)

description prop으로 CTA의 설명을 설정할 수 있어요.

<template>
  <UPageCTA title="Trusted and supported by our amazing community" description="We've built a strong, lasting partnership. Their trust is our driving force, propelling us towards shared success." />
</template>

links prop으로 설명 아래에 Button 목록을 표시할 수 있어요.

<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'

const links = ref<ButtonProps[]>([
  {
    label: "Get started",
    color: "neutral"
  },
  {
    label: "Learn more",
    color: "neutral",
    variant: "subtle",
    trailingIcon: "i-lucide-arrow-right"
  }
])
</script>

<template>
  <UPageCTA title="Trusted and supported by our amazing community" description="We've built a strong, lasting partnership. Their trust is our driving force, propelling us towards shared success." :links="links" />
</template>

변형 (Variant)

variant prop으로 CTA의 스타일을 바꿀 수 있어요.

<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'

const links = ref<ButtonProps[]>([
  {
    label: "Get started",
    color: "neutral"
  },
  {
    label: "Learn more",
    color: "neutral",
    variant: "subtle",
    trailingIcon: "i-lucide-arrow-right"
  }
])
</script>

<template>
  <UPageCTA title="Trusted and supported by our amazing community" description="We've built a strong, lasting partnership. Their trust is our driving force, propelling us towards shared success." variant="soft" :links="links" />
</template>

[!TIP]

You can apply the light or dark class to the links slot when using the solid variant to reverse the colors.

solid 변형을 사용할 때 links 슬롯에 light나 dark 클래스를 적용하면 색상을 반전시킬 수 있어요.

방향 (Orientation)

orientation prop으로 기본 슬롯과의 방향을 바꿀 수 있어요. 기본값은 vertical이에요.

<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'

const links = ref<ButtonProps[]>([
  {
    label: "Get started",
    color: "neutral"
  },
  {
    label: "Learn more",
    color: "neutral",
    variant: "subtle",
    trailingIcon: "i-lucide-arrow-right"
  }
])
</script>

<template>
  <UPageCTA title="Trusted and supported by our amazing community" description="We've built a strong, lasting partnership. Their trust is our driving force, propelling us towards shared success." orientation="horizontal" :links="links">
    <img src="https://picsum.photos/640/728" width="320" height="364" alt="Illustration" class="w-full rounded-lg" loading="lazy" />
  </UPageCTA>
</template>

뒤집기 (Reverse)

reverse prop으로 기본 슬롯의 방향을 뒤집을 수 있어요.

<script setup lang="ts">
import type { ButtonProps } from '@nuxt/ui'

const links = ref<ButtonProps[]>([
  {
    label: "Get started",
    color: "neutral"
  },
  {
    label: "Learn more",
    color: "neutral",
    variant: "subtle",
    trailingIcon: "i-lucide-arrow-right"
  }
])
</script>

<template>
  <UPageCTA title="Trusted and supported by our amazing community" description="We've built a strong, lasting partnership. Their trust is our driving force, propelling us towards shared success." orientation="horizontal" reverse :links="links">
    <img src="https://picsum.photos/640/728" width="320" height="364" alt="Illustration" class="w-full rounded-lg" loading="lazy" />
  </UPageCTA>
</template>

API

Props

/**
 * Props for the PageCTA component
 */
interface PageCTAProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  title?: string | undefined;
  description?: string | undefined;
  /**
   * The orientation of the page cta.
   * @default 'vertical'
   */
  orientation?: "vertical" | "horizontal" | undefined;
  /**
   * Reverse the order of the default slot.
   * @default false
   */
  reverse?: boolean | undefined;
  /**
   * @default 'outline'
   */
  variant?: "outline" | "solid" | "soft" | "subtle" | "naked" | undefined;
  /**
   * Display a list of Button under the description.
   * `{ size: 'lg' }`{lang="ts-type"}
   */
  links?: ButtonProps[] | undefined;
  ui?: { root?: SlotClass; container?: SlotClass; wrapper?: SlotClass; header?: SlotClass; title?: SlotClass; description?: SlotClass; body?: SlotClass; footer?: SlotClass; links?: SlotClass; } | undefined;
}

Slots

/**
 * Slots for the PageCTA component
 */
interface PageCTASlots {
  top(): any;
  header(): any;
  title(): any;
  description(): any;
  body(): any;
  footer(): any;
  links(): any;
  default(): any;
  bottom(): any;
}

테마 (Theme)

export default defineAppConfig({
  ui: {
    pageCTA: {
      slots: {
        root: 'relative isolate rounded-xl overflow-hidden',
        container: 'flex flex-col lg:grid px-6 py-12 sm:px-12 sm:py-24 lg:px-16 lg:py-24 gap-8 sm:gap-16',
        wrapper: '',
        header: '',
        title: 'text-3xl sm:text-4xl text-pretty tracking-tight font-bold text-highlighted',
        description: 'text-base sm:text-lg text-muted',
        body: 'mt-8',
        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'
          },
          vertical: {
            container: '',
            title: 'text-center',
            description: 'text-center text-balance',
            links: 'justify-center'
          }
        },
        reverse: {
          true: {
            wrapper: 'order-last'
          }
        },
        variant: {
          solid: {
            root: 'bg-inverted text-inverted',
            title: 'text-inverted',
            description: 'text-dimmed'
          },
          outline: {
            root: 'bg-default ring ring-default',
            description: 'text-muted'
          },
          soft: {
            root: 'bg-elevated/50',
            description: 'text-toned'
          },
          subtle: {
            root: 'bg-elevated/50 ring ring-default',
            description: 'text-toned'
          },
          naked: {
            description: 'text-muted'
          }
        },
        title: {
          true: {
            description: 'mt-6'
          }
        }
      },
      defaultVariants: {
        variant: 'outline'
      }
    }
  }
})

변경 이력 (Changelog)

컴포넌트와 테마의 커밋 히스토리를 참고하세요.


더 알아보기 (Learn more)