Scroll area
Playground
TSX
'use client';
import { ScrollArea, type ScrollAreaVariant } from '@mbsw/ui';
export default function Demo() {
const settings = {
"variant": "vertical"
};
const variant = settings.variant as ScrollAreaVariant;
const horizontal = variant === 'horizontal';
const concurrently = variant === 'concurrently';
const items = Array.from(
{ length: concurrently ? 24 : 20 },
(_, index) => `content ${index + 1}`,
);
return (
<ScrollArea
key={variant}
variant={variant}
style={{ width: 320, maxWidth: '100%', height: 240 }}
viewportProps={{
role: 'region',
'aria-label': "콘텐츠 목록",
style: { overscrollBehavior: 'contain' },
}}
>
<ul
style={{
display: 'grid',
gridAutoFlow: horizontal ? 'column' : 'row',
gridAutoColumns: horizontal ? 168 : undefined,
gridTemplateColumns: concurrently ? 'repeat(3, 1fr)' : undefined,
minWidth: concurrently ? 560 : undefined,
gap: horizontal || concurrently ? 12 : 0,
listStyle: 'none',
padding: 0,
margin: 0,
}}
>
{items.map((content, index) => (
<li
key={index}
style={{
display: 'flex',
flexDirection: horizontal ? 'column' : 'row',
alignItems: horizontal ? 'flex-start' : 'center',
gap: 12,
padding: horizontal ? 16 : '16px 12px',
height: horizontal ? 208 : undefined,
borderBottom: '1px solid var(--riido-border-subtle)',
background: 'var(--riido-surface-1)',
}}
>
<span>{content}</span>
</li>
))}
</ul>
</ScrollArea>
);
}
Properties
Direction
Usage
높이와 너비는 앱에서 지정합니다. vertical, horizontal, concurrently 중 콘텐츠에 맞는 방향을 사용합니다.
TSX
'use client';
import { ScrollArea } from '@mbsw/ui';
export default function Example() {
return (
<ScrollArea
style={{ height: 240, width: 320, maxWidth: '100%' }}
viewportProps={{ role: 'region', 'aria-label': "콘텐츠 목록" }}
>
{Array.from({ length: 20 }, (_, index) => (
<p key={index}>content {index + 1}</p>
))}
</ScrollArea>
);
}
Playground의 Code 탭에서 현재 설정과 동작이 포함된 예제 전체를 복사할 수 있습니다. 공통 CSS 설치는 설치하기를 확인하세요.