ScrollArea
ScrollArea는 브라우저 기본 스크롤바를 대체하는 크로스 브라우저, 경량, 테마 적용 가능한 컴포넌트예요. 브라우저마다 제각각인 기본 스크롤바 대신, 디자인에 맞춘 일관된 스크롤바를 쓰고 싶을 때 고르기 좋아요.
출처: 문서
본문
사용법 (Usage)
import { ScrollArea } from '@primereact/ui/scrollarea';
<ScrollArea.Root>
<ScrollArea.Viewport>
<ScrollArea.Content />
</ScrollArea.Viewport>
<ScrollArea.Scrollbar>
<ScrollArea.Handle />
</ScrollArea.Scrollbar>
</ScrollArea.Root>
예시 (Examples)
기본 (Basic)
스타일이 적용된 스크롤바를 가진 커스텀 스크롤 컨테이너예요.
가로 (Horizontal)
ScrollArea는 가로 뷰포트를 벗어나는 콘텐츠에 대해 가로 스크롤을 지원해요.
두 스크롤바 모두 (Both Scrollbars)
페이드 스크롤 (Scroll Fade)
변형 (Variant)
variant 속성으로 스크롤바의 표시 동작을 바꿀 수 있어요.
커스텀 (Custom)
관련 문서 (Related)
서브 컴포넌트 (Sub-Components)
ScrollAreaRoot, ScrollAreaViewport, ScrollAreaContent, ScrollAreaScrollbar, ScrollAreaHandle 컴포넌트 문서는 Primitive API에서 확인하세요.
훅 (Hooks)
useScrollArea 훅 문서는 Headless API에서 확인하세요.
접근성 (Accessibility)
WAI-ARIA 준수 세부사항과 키보드 지원은 ScrollArea Primitive에서 확인하세요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-scrollarea | Class name of the root element |
| p-scrollarea-viewport | Class name of the viewport element |
| p-scrollarea-scrollbar | Class name of the scrollbar element |
| p-scrollarea-handle | Class name of the handle element |
| p-scrollarea-corner | Class name of the corner element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| scrollpanel.transition.duration | --p-scrollpanel-transition-duration | Transition duration of root |
| scrollpanel.bar.size | --p-scrollpanel-bar-size | Size of bar |
| scrollpanel.bar.border.radius | --p-scrollpanel-bar-border-radius | Border radius of bar |
| scrollpanel.bar.focus.ring.width | --p-scrollpanel-bar-focus-ring-width | Focus ring width of bar |
| scrollpanel.bar.focus.ring.style | --p-scrollpanel-bar-focus-ring-style | Focus ring style of bar |
| scrollpanel.bar.focus.ring.color | --p-scrollpanel-bar-focus-ring-color | Focus ring color of bar |
| scrollpanel.bar.focus.ring.offset | --p-scrollpanel-bar-focus-ring-offset | Focus ring offset of bar |
| scrollpanel.bar.focus.ring.shadow | --p-scrollpanel-bar-focus-ring-shadow | Focus ring shadow of bar |
| scrollpanel.bar.background | --p-scrollpanel-bar-background | Background of bar |
더 알아보기 (Learn more)
- ScrollArea 서브 컴포넌트의 세부 API를 Primitive 문서에서 살펴보세요.
variant속성으로 스크롤바 표시 방식을 사용자 경험에 맞게 조정해 보세요.