ScrollPanel is a cross browser, lightweight and skinnable alternative to native browser scrollbar.
import ScrollPanel from 'primevue/scrollpanel';
ScrollPanel is defined using dimensions for the scrollable viewport.
<ScrollPanel style="width: 100%; height: 200px">
<p>
Lorem ipsum dolor ...
</p>
</ScrollPanel>
Scrollbar visuals can be styled for a unified look across different platforms.
<ScrollPanel
style="width: 100%; height: 200px"
:pt="{
wrapper: {
style: { 'border-right': 'rgb(var(--primary-400)/10%)' }
},
bary: 'relative z-20 w-[9px] top-0 rounded-full bg-primary-300 hover:bg-primary-400'
}"
>
<p>
Lorem ipsum dolor sit amet...
</p>
</ScrollPanel>
<ScrollPanel
style="width: 100%; height: 200px"
:pt="{
wrapper: {
style: 'border-right: 10px solid rgb(var(--primary-400)/10%); border-bottom: 10px solid rgb(var(--primary-400)/10%);'
},
bary: 'relative z-20 w-[9px] top-0 rounded-none bg-surface-300 hover:bg-surface-400'
}"
>
<p>
Lorem ipsum dolor sit amet...
</p>
</ScrollPanel>
Scrollbars of the ScrollPanel has a scrollbar role along with the aria-controls attribute that refers to the id of the scrollable content container and the aria-orientation to indicate the orientation of scrolling.
Key | Function |
---|---|
tab | Moves focus through the bar. |
down arrow | Scrolls content down when vertical scrolling is available. |
up arrow | Scrolls content up when vertical scrolling is available. |
left | Scrolls content left when horizontal scrolling is available. |
right | Scrolls content right when horizontal scrolling is available. |