For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/scroll-area.md.
v0.0.57
  • 简体中文
  • ScrollArea

    数据展示@rockshin/tao-ui

    为受限区域提供跨浏览器一致的滚动条与阴影提示。

    何时使用

    局部内容必须限制尺寸并独立滚动时使用 ScrollArea。

    推荐

    • 明确滚动方向和尺寸上限。
    • 触摸与键盘用户都应能访问内容。

    避免

    • 不要制造不必要的嵌套滚动区域。

    代码演示

    基础用法

    Activity item 1

    Activity item 2

    Activity item 3

    Activity item 4

    Activity item 5

    Activity item 6

    Activity item 7

    Activity item 8

    Activity item 9

    Activity item 10

    Activity item 11

    Activity item 12

    TSX

    水平与双轴滚动

    A long horizontal timeline that remains inside its own scroll area.
    Content that can scroll on both axes.
    TSX

    常驻滚动条与自定义尺寸

    Scrollable row 1

    Scrollable row 2

    Scrollable row 3

    Scrollable row 4

    Scrollable row 5

    Scrollable row 6

    Scrollable row 7

    Scrollable row 8

    Scrollable row 9

    Scrollable row 10

    Scrollable row 1

    Scrollable row 2

    Scrollable row 3

    Scrollable row 4

    Scrollable row 5

    Scrollable row 6

    Scrollable row 7

    Scrollable row 8

    Scrollable row 9

    Scrollable row 10

    TSX

    横向滚动

    为横向内容设置有限宽度,并用 orientation 显示对应滚动条。

    Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12Item 13Item 14Item 15Item 16Item 17Item 18Item 19Item 20
    TSX

    双向滚动

    内容同时超出宽高时分别滚动,外层页面不承担内容的横向溢出。

    Item 1 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 2 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 3 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 4 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 5 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 6 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 7 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 8 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 9 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 10 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 11 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 12 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 13 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 14 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 15 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 16 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 17 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 18 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 19 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 20 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 21 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 22 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 23 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 24 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 25 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 26 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 27 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 28 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 29 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 30 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 31 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 32 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 33 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 34 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 35 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 36 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 37 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 38 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 39 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 40 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 41 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 42 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 43 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 44 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 45 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 46 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 47 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 48 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 49 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    Item 50 — This is a long line that overflows the container horizontally to demonstrate both scrollbars.

    TSX

    始终显示滚动条

    type="always" 保留滚动条轨道,适用于滚动能力需要更明显的区域。

    Item 1

    Item 2

    Item 3

    Item 4

    Item 5

    Item 6

    Item 7

    Item 8

    Item 9

    Item 10

    Item 11

    Item 12

    Item 13

    Item 14

    Item 15

    Item 16

    Item 17

    Item 18

    Item 19

    Item 20

    Item 21

    Item 22

    Item 23

    Item 24

    Item 25

    Item 26

    Item 27

    Item 28

    Item 29

    Item 30

    Item 31

    Item 32

    Item 33

    Item 34

    Item 35

    Item 36

    Item 37

    Item 38

    Item 39

    Item 40

    Item 41

    Item 42

    Item 43

    Item 44

    Item 45

    Item 46

    Item 47

    Item 48

    Item 49

    Item 50

    TSX

    滚动边缘提示

    边缘阴影提示还有未显示的内容,滚动到底部后对应提示消失。

    Item 1

    Item 2

    Item 3

    Item 4

    Item 5

    Item 6

    Item 7

    Item 8

    Item 9

    Item 10

    Item 11

    Item 12

    Item 13

    Item 14

    Item 15

    Item 16

    Item 17

    Item 18

    Item 19

    Item 20

    Item 21

    Item 22

    Item 23

    Item 24

    Item 25

    Item 26

    Item 27

    Item 28

    Item 29

    Item 30

    Item 31

    Item 32

    Item 33

    Item 34

    Item 35

    Item 36

    Item 37

    Item 38

    Item 39

    Item 40

    Item 41

    Item 42

    Item 43

    Item 44

    Item 45

    Item 46

    Item 47

    Item 48

    Item 49

    Item 50

    TSX

    滚动条尺寸

    调整滚动条尺寸,示例保留有界内容区域。

    Thin (4px)

    Item 1

    Item 2

    Item 3

    Item 4

    Item 5

    Item 6

    Item 7

    Item 8

    Item 9

    Item 10

    Item 11

    Item 12

    Item 13

    Item 14

    Item 15

    Item 16

    Item 17

    Item 18

    Item 19

    Item 20

    Item 21

    Item 22

    Item 23

    Item 24

    Item 25

    Item 26

    Item 27

    Item 28

    Item 29

    Item 30

    Thick (10px)

    Item 1

    Item 2

    Item 3

    Item 4

    Item 5

    Item 6

    Item 7

    Item 8

    Item 9

    Item 10

    Item 11

    Item 12

    Item 13

    Item 14

    Item 15

    Item 16

    Item 17

    Item 18

    Item 19

    Item 20

    Item 21

    Item 22

    Item 23

    Item 24

    Item 25

    Item 26

    Item 27

    Item 28

    Item 29

    Item 30

    TSX

    横向边缘提示

    横向滚动时使用两侧阴影提示内容延伸方向。

    Item 1
    Item 2
    Item 3
    Item 4
    Item 5
    Item 6
    Item 7
    Item 8
    Item 9
    Item 10
    Item 11
    Item 12
    Item 13
    Item 14
    Item 15
    Item 16
    Item 17
    Item 18
    Item 19
    Item 20
    Item 21
    Item 22
    Item 23
    Item 24
    Item 25
    Item 26
    Item 27
    Item 28
    Item 29
    Item 30
    TSX

    API

    ScrollArea

    属性说明类型默认值
    typeScrollbar visibility behaviorScrollAreaType | undefinedhover
    directionScroll direction"vertical" | "horizontal" | "both" | undefinedvertical
    maxHeightMax height — enables vertical scrollstring | number | undefined-
    maxWidthMax width — enables horizontal scrollstring | number | undefined-
    scrollbarSizeScrollbar size in pxnumber | undefined6
    scrollbarOffsetOffset from edges in pxnumber | undefined2
    scrollShadowShow scroll shadows at edgesboolean | undefined-
    onScrollCallback on scroll((e: UIEvent<HTMLDivElement, UIEvent>) => void) | undefined-
    onScrollEndCallback when scrolled to bottom (threshold in px)(() => void) | undefined-
    scrollEndThresholdThreshold in px for onScrollEndnumber | undefined10
    className节点类名string | undefined-
    style节点样式CSSProperties | undefined-