ScrollArea
@rockshin/tao-ui为受限区域提供跨浏览器一致的滚动条与阴影提示。
何时使用
局部内容必须限制尺寸并独立滚动时使用 ScrollArea。
推荐
- 明确滚动方向和尺寸上限。
- 触摸与键盘用户都应能访问内容。
避免
- 不要制造不必要的嵌套滚动区域。
代码演示
基础用法
水平与双轴滚动
常驻滚动条与自定义尺寸
横向滚动
为横向内容设置有限宽度,并用 orientation 显示对应滚动条。
双向滚动
内容同时超出宽高时分别滚动,外层页面不承担内容的横向溢出。
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.
始终显示滚动条
type="always" 保留滚动条轨道,适用于滚动能力需要更明显的区域。
滚动边缘提示
边缘阴影提示还有未显示的内容,滚动到底部后对应提示消失。
滚动条尺寸
调整滚动条尺寸,示例保留有界内容区域。
Thin (4px)
Thick (10px)
横向边缘提示
横向滚动时使用两侧阴影提示内容延伸方向。