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

Vue ScrollPanel 컴포넌트

원문 보기 위키 갱신

ScrollPanel은 네이티브 브라우저 스크롤바를 대체하는 크로스 브라우저, 경량, 스킨 가능한 컴포넌트예요. 플랫폼마다 다른 스크롤바 외관을 하나로 통일하고 싶을 때 유용해요.

출처: 문서

본문

Vue ScrollPanel Component

ScrollPanel is a cross browser, lightweight and skinnable alternative to native browser scrollbar.

Import

import ScrollPanel from 'primevue/scrollpanel';

Accessibility

Screen Reader ScrollPanel의 스크롤바는 scrollbar role과 함께, 스크롤 가능한 콘텐츠 컨테이너의 id를 가리키는 aria-controls 속성과 스크롤 방향을 나타내는 aria-orientation을 가져요. Header Keyboard Support Key Function tab 바를 통해 포커스를 이동해요. down arrow 세로 스크롤이 가능할 때 콘텐츠를 아래로 스크롤해요. up arrow 세로 스크롤이 가능할 때 콘텐츠를 위로 스크롤해요. left 가로 스크롤이 가능할 때 콘텐츠를 왼쪽으로 스크롤해요. right 가로 스크롤이 가능할 때 콘텐츠를 오른쪽으로 스크롤해요.

Basic

ScrollPanel은 스크롤 가능한 뷰포트의 크기로 정의해요.

<ScrollPanel style="width: 100%; height: 200px">
    <p>
        Lorem ipsum dolor ...
    </p>
</ScrollPanel>

Custom

플랫폼마다 통일된 외관을 위해 스크롤바 비주얼을 스타일링할 수 있어요.

<ScrollPanel
    style="width: 100%; height: 200px"
    :dt="{
        bar: {
            background: '{primary.color}'
        }
    }"
>
    ...
</ScrollPanel>
Composition API Example
<template>
    <div class="card">
        <ScrollPanel
            style="width: 100%; height: 200px"
            :dt="{
                bar: {
                    background: '{primary.color}'
                }
            }"
        >
            ...
        </ScrollPanel>
    </div>
</template>

<script setup>
<\/script>

Scroll Panel

Props

Name Type Default Description
step number 5 Step factor to scroll the content while pressing the arrow keys.
dt any - It generates scoped CSS variables using design tokens for the component.
pt PassThrough - Used to pass attributes to DOM elements inside the component.
ptOptions any - Used to configure passthrough(pt) options of the component.
unstyled boolean false When enabled, it removes component related styles in the core.

Slots

Name Parameters Description
default Function

Pass Through Options

Name Type Description
root ScrollPanelPassThroughOptionType Used to pass attributes to the root's DOM element.
contentContainer ScrollPanelPassThroughOptionType Used to pass attributes to the content container's DOM element.
content ScrollPanelPassThroughOptionType Used to pass attributes to the content's DOM element.
barX ScrollPanelPassThroughOptionType Used to pass attributes to the horizontal panel's DOM element.
barY ScrollPanelPassThroughOptionType Used to pass attributes to the vertical panel's DOM element.
hooks any Used to manage all lifecycle hooks.

Theming

CSS Classes

Class Description
p-scrollpanel Class name of the root element
p-scrollpanel-content-container Class name of the content container element
p-scrollpanel-content Class name of the content element
p-scrollpanel-bar-x Class name of the bar x element
p-scrollpanel-bar-y Class name of the bar y 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)