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

Carousel — 다양한 옵션을 갖춘 콘텐츠 슬라이더

원문 보기 위키 갱신

Carousel은 여러 콘텐츠를 슬라이드로 넘겨가며 보여 주는 컴포넌트예요. 정렬·방향·루프·자동 크기 등 다양한 커스터마이즈 옵션을 지원해요.

출처: 문서

본문

Carousel은 다양한 커스터마이즈 옵션을 갖춘 콘텐츠 슬라이더예요.

사용법 (Usage)

import { Carousel } from '@primereact/ui/carousel';
<Carousel.Root>
    <Carousel.Content>
        <Carousel.Item></Carousel.Item>
    </Carousel.Content>
    <Carousel.Indicators />
    <Carousel.Prev></Carousel.Prev>
    <Carousel.Next></Carousel.Next>
</Carousel.Root>

예시

기본 (Basic)

탐색 컨트롤을 사용해 항목 집합을 순환해서 보여 줘요.

정렬 (Alignment)

align 속성으로 캐러셀 항목을 정렬할 수 있어요. slidesPerPage 속성은 한 페이지에 보이는 슬라이드 수를 제어해요.

방향 (Orientation)

orientation 속성으로 캐러셀의 방향을 바꿀 수 있어요.

루프 (Loop)

loop 속성으로 루프 모드를 활성화할 수 있어요.

가변 크기 (Variable Size)

autoSize 속성으로 자동 크기 모드를 활성화하고, 캐러셀 항목의 너비를 설정할 수 있어요.

slide 속성을 사용해 특정 인덱스의 슬라이드로 스크롤하는 방법을 보여 주는 데모예요.

동적 (Dynamic)

항목은 런타임에서 추가하거나 제거할 수 있어요. 캐러셀이 자신의 콘텐츠를 관찰하면서 스냅 포인트를 다시 계산해, 인디케이터와 내비게이션이 계속 동기화되도록 유지해요.

관련 자료

하위 컴포넌트 (Sub-Components)

CarouselRoot, CarouselContent, CarouselItem, CarouselPrev, CarouselNext, CarouselIndicators, CarouselIndicator 컴포넌트 문서는 Primitive API에서 확인할 수 있어요.

훅 (Hooks)

useCarousel 훅 문서는 Headless API에서 확인할 수 있어요.

접근성 (Accessibility)

WAI-ARIA 준수 사항과 키보드 지원에 대한 자세한 내용은 Carousel Primitive에서 볼 수 있어요.

테마 (Theming)

CSS 클래스 (CSS Classes)

styled 모드에서 사용하는 클래스 이름 목록이에요.

ClassName Description
p-carousel Class name of the root element

디자인 토큰 (Design Tokens)

디자인 토큰 목록이에요.

Token CSS Variable Description
carousel.transition.duration --p-carousel-transition-duration Transition duration of root
carousel.content.gap --p-carousel-content-gap Gap of content
carousel.indicator.list.padding --p-carousel-indicator-list-padding Padding of indicator list
carousel.indicator.list.gap --p-carousel-indicator-list-gap Gap of indicator list
carousel.indicator.width --p-carousel-indicator-width Width of indicator
carousel.indicator.height --p-carousel-indicator-height Height of indicator
carousel.indicator.border.radius --p-carousel-indicator-border-radius Border radius of indicator
carousel.indicator.focus.ring.width --p-carousel-indicator-focus-ring-width Focus ring width of indicator
carousel.indicator.focus.ring.style --p-carousel-indicator-focus-ring-style Focus ring style of indicator
carousel.indicator.focus.ring.color --p-carousel-indicator-focus-ring-color Focus ring color of indicator
carousel.indicator.focus.ring.offset --p-carousel-indicator-focus-ring-offset Focus ring offset of indicator
carousel.indicator.focus.ring.shadow --p-carousel-indicator-focus-ring-shadow Focus ring shadow of indicator
carousel.indicator.background --p-carousel-indicator-background Background of indicator
carousel.indicator.hover.background --p-carousel-indicator-hover-background Hover background of indicator
carousel.indicator.active.background --p-carousel-indicator-active-background Active background of indicator

더 알아보기 (Learn more)