Scroll Status
React Bootstrap 5 Scroll Status plugin
Scroll Status plugin creates progress bar indicating page or component scroll level.
Scroll status plugin built with the latest Bootstrap 5. Creates a progress bar indicating page or component scroll level.Note: Read the API tab to find all available options and advanced customization
Basic example
Create default Scroll Status by adding <MDBScrollStatus>
with containerRef
pro addressing a container
element with scroll option.
Some content here
Global example
Create element indicating global page scroll level.
Styling
Color
Change default color of Scroll Status bar with
color
prop.
Some content here
Position
Change default vertical position of Scroll Status with
offset
prop.
Some content here
Height
Change default height of Scroll Status bar with
height
prop.
Some content here
Trigger
One-time open on modal example
Fires onScrollTarget
function immediately when the scroll
value is exceeded. Below is an example using a modal.
Some content here
Multiple open on modal example
To trigger a passed function multiple times, add triggerOnce={false}
prop.
Some content here
Scroll Status - API
Import
Properties
MDBScrollStatus
Name | Type | Default | Description | Example |
---|---|---|---|---|
className
|
string | '' |
Add custom class to MDBScrollStatus |
<MDBScrollStatus className="class" />
|
color
|
string | '#1266F1' |
Defines color of the progress bar. |
<MDBScrollStatus color='#000' />
|
containerRef
|
React.MutableRefObject<any> |
|
A reference to the object whose scroll value will be shown. |
<MDBScrollStatus containerRef={someRef} />
|
global
|
boolean | false |
If value is true, it will show global scroll (window scroll). |
<MDBScrollStatus global />
|
height
|
string | 10px |
Defines height of the progress bar. |
<MDBScrollStatus height='20px' />
|
offset
|
number | 0 |
Defines offset of the progress bar. |
<MDBScrollStatus offset={10} />
|
scroll
|
number | - |
Defines percentage value which crossing will trigger onScrollTarget event. |
<MDBScrollStatus scroll={50} />
|
triggerOnce
|
boolean | true |
If value is true, it will trigger onScrollTarget just once. |
<MDBScrollStatus triggerOnce={false} />
|
Events
Name | Type | Description |
---|---|---|
onScroll
|
(value: any) => any | Returns the current scroll percentage. |
onScrollTarget
|
() => any | Fires immediately when the scroll value is exceeded |