Scroll area

A component that provides a customizable scrollable area with a custom scrollbar.

Examples

You can use the scroll area component to create a scrollable area for both horizontal and vertical content. Use the orientation property to set the orientation of the scroll area.

Very long horizontal scrollable content ,yes it is very long, try to scroll
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
Very long horizontal scrollable content ,yes it is very long, try to scroll
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
A lot of horizontal content
Importing Per-component import (Recommended)

Import the component by its own subpath. This registers <dap-ds-scroll-area> (and the components it renders internally) and lets your bundler include only what you use:

import 'dap-design-system/components/scroll-area'

Need a reference to the class (e.g. to register it manually or extend it)? The same subpath default-exports it:

import DapDSScrollArea from 'dap-design-system/components/scroll-area'
Register everything

Register the whole library at once — convenient, but pulls every component into your bundle:

import 'dap-design-system'
Importing React
import { DapDSScrollAreaReact } from 'dap-design-system/react'
Attributes
PropertyTypeDefaultDescription
orientation'vertical', 'horizontal' , 'both''vertical'The orientation of the scrollbar.
ariaLabelstring, nullnullAccessible label for the element. Use this to provide a text alternative
for elements that don't have visible text content.
ariaExpanded'true', 'false'nullIndicates whether the element is expanded or collapsed.
ariaControlsstring, nullnullIdentifies the element that is controlled by this element.
ariaHasPopupstring, nullnullIndicates the availability and type of interactive popup element.
ariaDescribedBystring, nullnullIdentifies the element that describes the current element.
ariaPressed'true', 'false' , 'mixed'nullIndicates the current "pressed" state of toggle buttons.
ariaHidden'true', 'false'nullIndicates whether the element is hidden from accessibility APIs.
customStylesstring, undefinedCustom CSS text to be merged with the component's styles.
This CSS will be injected into the shadow DOM and merged with the component's static styles.
Slots
NameDescription
(default)The content to be scrolled
Events

No custom events available.

CSS Parts
Part NameDescription
viewportThe viewport element that contains the scrollable content
scrollbarThe scrollbar container
baseThe main scroll area container.
thumbThe thumb of the scrollbar.
How to Use CSS Parts

You can style CSS parts using the ::part() pseudo-element selector:

/* Target a specific part */
.my-custom-dap-ds-scroll-area::part(viewport) {
  /* Your custom styles */
}

/* Target multiple parts */
.my-custom-dap-ds-scroll-area::part(viewport),
.my-custom-dap-ds-scroll-area::part(scrollbar) {
  /* Shared styles */
}

Example usage:

<dap-ds-scroll-area class="my-custom-dap-ds-scroll-area">
  Scroll area
</dap-ds-scroll-area>
.my-custom-dap-ds-scroll-area::part(viewport) {
  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.

CSS Custom Properties
Property NameDescription
--dds-scroll-area-radiusThe border radius of the scroll area and its elements (default: var(--dds-radius-base))
--dds-scroll-area-backgroundThe background color of the scroll area (default: var(--dds-background-neutral-base))
--dds-scroll-area-scrollbar-backgroundThe background color of the scrollbar (default: var(--dds-background-neutral-subtle))
--dds-scroll-area-thumb-backgroundThe background color of the scrollbar thumb (default: var(--dds-background-neutral-interactive))
--dds-scroll-area-thumb-hover-backgroundThe background color of the scrollbar thumb on hover (default: var(--dds-background-neutral-interactive-hover))
--dds-scroll-area-thumb-active-backgroundThe background color of the scrollbar thumb when active (default: var(--dds-background-neutral-interactive-active))
--dds-scroll-area-transitionThe transition timing for scrollbar interactions (default: var(--dds-transition-fast) var(--dds-easing-ease-out))
--dds-scroll-area-scrollbar-sizeThe width/height of the scrollbar (default: 10px)
How to Use CSS Custom Properties

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-area
  style="--dds-scroll-area-radius: value; --dds-scroll-area-background: value;">
  Scroll area
</dap-ds-scroll-area>

Method 2: CSS classes (Reusable styles)

.my-custom-dap-ds-scroll-area {
  --dds-scroll-area-radius: value;
  --dds-scroll-area-background: value;
  --dds-scroll-area-scrollbar-background: value;
}
<dap-ds-scroll-area class="my-custom-dap-ds-scroll-area">
  Scroll area
</dap-ds-scroll-area>

Method 3: Global theme customization

/* Apply to all instances */
dap-ds-scroll-area {
  --dds-scroll-area-radius: value;
  --dds-scroll-area-background: value;
}

CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.