ScrollArea
Contêiner rolável com estilo personalizado baseado no Radix UI, com scrollbar temática e suporte a eixos vertical, horizontal ou ambos.
Demonstração
Vertical
Horizontal
Props
| Prop | Tipo | Padrão | Descrição |
|---|---|---|---|
orientation | 'vertical' | 'horizontal' | 'both' | 'vertical' | Which scrollbar(s) to render. |
children | React.ReactNode | — | Scrollable content. |
className | string | — | Extra CSS class on the root element. |
Uso
import { ScrollArea } from '@ghiberti85/ui'
// Vertical (default)
<ScrollArea style={{ height: 200 }}>
{items.map(i => <div key={i}>{i}</div>)}
</ScrollArea>
// Horizontal
<ScrollArea orientation="horizontal" style={{ width: 300 }}>
<div style={{ display: 'flex', gap: 8, width: 'max-content' }}>
{tags.map(t => <span key={t}>{t}</span>)}
</div>
</ScrollArea>
// Both axes
<ScrollArea orientation="both" style={{ height: 200, width: 300 }}>
<div style={{ width: 600, height: 600 }}>Large content</div>
</ScrollArea>