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.

<dap-ds-stack direction="row" spacing="700">
  <dap-ds-scroll-area
    style={{ width: 200, height: 300 }}
    orientation="horizontal"
  >
    <div style={{ whiteSpace: 'nowrap' }}>
      Very long horizontal scrollable content ,yes it is very long, try to scroll
    </div>
  </dap-ds-scroll-area>
  <dap-ds-scroll-area
    style={{ width: 200, height: 300 }}
    orientation="vertical"
  >
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
  </dap-ds-scroll-area>
  <dap-ds-scroll-area
    style={{ width: 200, height: 300 }}
    orientation="both"
  >
    <div style={{ whiteSpace: 'nowrap' }}>
      Very long horizontal scrollable content ,yes it is very long, try to scroll
    </div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
    <div>A lot of horizontal content</div>
  </dap-ds-scroll-area>
</dap-ds-stack>
Importing
import { DapDSScrollArea } from 'dap-design-system/dist/dds'
Importing React
import { DapDSScrollAreaReact } from 'dap-design-system/dist/react'
Attributes
PropertyTypeDefaultDescription
orientation'vertical', 'horizontal' , 'both''vertical'The orientation of the scrollbar.
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
cornerThe corner between vertical and horizontal scrollbars
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)