The scroll progress component displays a visual progress bar that tracks scroll position, providing users with feedback about their reading or navigation progress. It supports both page-level (global) and container-level scroll tracking, making it versatile for various use cases from article reading progress to long-form content navigation.
✅ Use scroll progress when:
- Displaying reading progress through long articles or blog posts
- Tracking navigation through lengthy documentation pages
- Providing visual feedback in scrollable containers (modals, sidebars, content areas)
- Enhancing user experience in single-page applications with long content
- Creating a sense of progress in onboarding flows or tutorials
❌ Don't use scroll progress for:
- Short content that doesn't require scrolling
- Replacing proper navigation or table of contents
- Critical information that must be visible without scrolling
- Mobile-first experiences where space is extremely limited
The default scroll progress bar tracks the entire page scroll and is fixed at the top of the viewport:
Scroll Down to See Progress on the top of this page
When a target attribute is provided, the progress bar tracks scroll within a specific container instead of the entire page:
Container Scroll Progress
The progress bar below tracks scroll within the container.
Scroll within this container to see the progress bar update.
Paragraph 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 2 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 3 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 4 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 5 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 6 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 7 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Paragraph 8 - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
The scroll progress component supports five color variants to match different contexts and themes:
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
The inverted variant is designed for use on dark backgrounds:
Scroll Progress - Inverted Variant
For use on dark backgrounds.
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
The scroll progress component comes in three sizes: extra small (2px), small (4px - default), and medium (6px):
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
Scroll content 1
Scroll content 2
Scroll content 3
Scroll content 4
Scroll content 5
The scroll progress component supports customization through CSS custom properties and parts.
Custom Styled Progress
Scroll to see the custom-colored progress bar.
import { DapDSScrollProgress } from 'dap-design-system'
import { DapDSScrollProgressReact } from 'dap-design-system/react'
For optimal bundle sizes, use the tree-shakeable import syntax:
import { DapDSScrollProgress } from 'dap-design-system/components'
| Property | Type | Default | Description |
|---|---|---|---|
target | string, undefined | CSS selector for scroll container. If not set, tracks global page scroll. | |
| When set, the component uses sticky positioning within the container. | |||
variant | "neutral", "brand" , "negative" , "positive" , "inverted" | 'brand' | The color variant of the progress indicator. |
size | 'xxs', 'xs' , 'sm' , 'md' , 'lg' | The size of the scroll progress bar. Default is sm. See SizedMixin. | |
sizeMap | string | Responsive size map (e.g. "md:lg"); see SizedMixin. |
No slots available.
No custom events available.
| Part Name | Description |
|---|---|
base | The main scroll progress container. |
track | The progress track (background). |
fill | The progress fill bar. |
You can style CSS parts using the ::part() pseudo-element selector:
/* Target a specific part */
.my-custom-dap-ds-scroll-progress::part(base) {
/* Your custom styles */
}
/* Target multiple parts */
.my-custom-dap-ds-scroll-progress::part(base),
.my-custom-dap-ds-scroll-progress::part(track) {
/* Shared styles */
}
Example usage:
<dap-ds-scroll-progress class="my-custom-dap-ds-scroll-progress">
Scroll Progress
</dap-ds-scroll-progress>
.my-custom-dap-ds-scroll-progress::part(base) {
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
CSS parts allow you to style internal elements of the component while maintaining encapsulation. Learn more in our styling guide.
| Property Name | Description |
|---|---|
--dds-scroll-progress-z-index | Z-index for fixed positioning (default: 1000) |
--dds-scroll-progress-transition | Transition for progress updates (default: width 0.1s ease-out) |
--dds-scroll-progress-track-color | Background color of the progress track (default: var(--dds-neutral-200)) |
--dds-scroll-progress-fill-color-neutral | Fill color for neutral variant |
--dds-scroll-progress-fill-color-brand | Fill color for brand variant |
--dds-scroll-progress-fill-color-negative | Fill color for negative variant |
--dds-scroll-progress-fill-color-positive | Fill color for positive variant |
--dds-scroll-progress-fill-color-inverted | Fill color for inverted variant |
CSS custom properties (CSS variables) can be set directly on the component or in your stylesheet:
Method 1: Inline styles (Quick customization)
<dap-ds-scroll-progress
style="--dds-scroll-progress-z-index: value; --dds-scroll-progress-transition: value;">
Scroll Progress
</dap-ds-scroll-progress>
Method 2: CSS classes (Reusable styles)
.my-custom-dap-ds-scroll-progress {
--dds-scroll-progress-z-index: value;
--dds-scroll-progress-transition: value;
--dds-scroll-progress-track-color: value;
}
<dap-ds-scroll-progress class="my-custom-dap-ds-scroll-progress">
Scroll Progress
</dap-ds-scroll-progress>
Method 3: Global theme customization
/* Apply to all instances */
dap-ds-scroll-progress {
--dds-scroll-progress-z-index: value;
--dds-scroll-progress-transition: value;
}
CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.