Dokumentation (english)

Scroll Area

Understand the design system and contribute to it

Component preview

The live preview for UI components is handled by components/atoms/codedocs/ComponentPreview.tsx. Use it directly inside MDX whenever you want a playground-style embed. Provide componentProps to set default values and propOptions to surface toggle-able props next to the preview.

Preview

Vertical scrolling:

Tags

Tag 1
Tag 2
Tag 3
Tag 4
Tag 5
Tag 6
Tag 7
Tag 8
Tag 9
Tag 10
Tag 11
Tag 12
Tag 13
Tag 14
Tag 15
Tag 16
Tag 17
Tag 18
Tag 19
Tag 20
Tag 21
Tag 22
Tag 23
Tag 24
Tag 25
Tag 26
Tag 27
Tag 28
Tag 29
Tag 30
Tag 31
Tag 32
Tag 33
Tag 34
Tag 35
Tag 36
Tag 37
Tag 38
Tag 39
Tag 40
Tag 41
Tag 42
Tag 43
Tag 44
Tag 45
Tag 46
Tag 47
Tag 48
Tag 49
Tag 50

Horizontal scrolling:

Tag 1

Item description

Tag 2

Item description

Tag 3

Item description

Tag 4

Item description

Tag 5

Item description

Tag 6

Item description

Tag 7

Item description

Tag 8

Item description

Tag 9

Item description

Tag 10

Item description

Tag 11

Item description

Tag 12

Item description

Tag 13

Item description

Tag 14

Item description

Tag 15

Item description

Tag 16

Item description

Tag 17

Item description

Tag 18

Item description

Tag 19

Item description

Tag 20

Item description

Tag 21

Item description

Tag 22

Item description

Tag 23

Item description

Tag 24

Item description

Tag 25

Item description

Tag 26

Item description

Tag 27

Item description

Tag 28

Item description

Tag 29

Item description

Tag 30

Item description

Tag 31

Item description

Tag 32

Item description

Tag 33

Item description

Tag 34

Item description

Tag 35

Item description

Tag 36

Item description

Tag 37

Item description

Tag 38

Item description

Tag 39

Item description

Tag 40

Item description

Tag 41

Item description

Tag 42

Item description

Tag 43

Item description

Tag 44

Item description

Tag 45

Item description

Tag 46

Item description

Tag 47

Item description

Tag 48

Item description

Tag 49

Item description

Tag 50

Item description

Both directions:

IDNameEmailDepartmentStatus
1User 1user1@example.comEngineeringActive
2User 2user2@example.comEngineeringActive
3User 3user3@example.comEngineeringActive
4User 4user4@example.comEngineeringActive
5User 5user5@example.comEngineeringActive
6User 6user6@example.comEngineeringActive
7User 7user7@example.comEngineeringActive
8User 8user8@example.comEngineeringActive
9User 9user9@example.comEngineeringActive
10User 10user10@example.comEngineeringActive
11User 11user11@example.comEngineeringActive
12User 12user12@example.comEngineeringActive
13User 13user13@example.comEngineeringActive
14User 14user14@example.comEngineeringActive
15User 15user15@example.comEngineeringActive
16User 16user16@example.comEngineeringActive
17User 17user17@example.comEngineeringActive
18User 18user18@example.comEngineeringActive
19User 19user19@example.comEngineeringActive
20User 20user20@example.comEngineeringActive

Prop reference

Auto-generated from the component source

ScrollArea

  • className
  • children

React.ComponentProps<typeof ScrollAreaPrimitive.Root>

ScrollBar

  • className
  • orientation = "vertical"

React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>


"use client";

import * as React from "react";
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";

import { cn } from "@/lib/utils";

function ScrollArea({
  className,
  children,
  ...props
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
  return (
    <ScrollAreaPrimitive.Root
      data-slot="scroll-area"
      className={cn("relative", className)}
      {...props}
    >
      <ScrollAreaPrimitive.Viewport
        data-slot="scroll-area-viewport"
        className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"
      >
        {children}
      </ScrollAreaPrimitive.Viewport>
      <ScrollBar />
      <ScrollAreaPrimitive.Corner />
    </ScrollAreaPrimitive.Root>
  );
}

function ScrollBar({
  className,
  orientation = "vertical",
  ...props
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
  return (
    <ScrollAreaPrimitive.ScrollAreaScrollbar
      data-slot="scroll-area-scrollbar"
      orientation={orientation}
      className={cn(
        "flex touch-none p-px transition-colors select-none",
        orientation === "vertical" &&
          "h-full w-2.5 border-l border-l-transparent",
        orientation === "horizontal" &&
          "h-2.5 flex-col border-t border-t-transparent",
        className
      )}
      {...props}
    >
      <ScrollAreaPrimitive.ScrollAreaThumb
        data-slot="scroll-area-thumb"
        className="bg-border relative flex-1 rounded-full"
      />
    </ScrollAreaPrimitive.ScrollAreaScrollbar>
  );
}

export { ScrollArea, ScrollBar };

On this page


Command Palette

Search for a command to run...

Schnellzugriffe
STRG + KSuche
STRG + DNachtmodus / Tagmodus
STRG + LSprache ändern

Software-Details
Kompiliert vor etwa 12 Stunden
Release: v4.0.0-production
Buildnummer: master@27db988
Historie: 34 Items