ScrollPanel is a cross browser, lightweight and skinnable alternative to native browser scrollbar.
import { ScrollPanel } from 'primereact/scrollpanel';
<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/scrollpanel/scrollpanel.min.js"></script>
ScrollPanel is defined using dimensions for the scrollable viewport.
<ScrollPanel style={{width: '100%', height: '200px'}}">
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
</ScrollPanel>
Look and feel can easily be customized, here is an example with a custom handle.
<ScrollPanel style={{width: '100%', height: '200px'}}" className="custom">
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
</ScrollPanel>
.custom .p-scrollpanel-wrapper {
border-right: 9px solid #f4f4f4;
}
.custom .p-scrollpanel-bar {
background-color: #1976d2;
opacity: 1;
transition: background-color .3s;
}
.custom .p-scrollpanel-bar:hover {
background-color: #135ba1;
}
Name | Type | Default | Description |
---|---|---|---|
id | string | null | Unique identifier of the element. |
style | string | null | Inline style of the component. |
className | string | null | Style class of the component. |
Name | Parameters | Description |
---|---|---|
refresh | - | Refreshes the position and size of the scrollbar. |
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-scrollpanel | Container element. |
p-scrollpanel-wrapper | Wrapper of content section. |
p-scrollpanel-content | Content section. |
p-scrollpanel-bar | Scrollbar handle. |
p-scrollpanel-bar-x | Scrollbar handle of a horizontal bar. |
p-scrollpanel-bar-y | Scrollbar handle of a vertical bar |
This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.
None.
Built-in component themes created by the PrimeReact Theme Designer.
Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.
Beautifully crafted premium create-react-app application templates by the PrimeTek design team.