When to use
- A canvas pans through a bounded document instead of scrolling DOM content.
When not to
- An ordinary DOM list: use native overflow scrolling.
Examples
Page sections
import { useState } from 'react'
import { Scrollbar } from '@kition/tessera-ui'
export default function Demo() {
const [offset, setOffset] = useState(0)
return (
<div style={{ display: 'flex', height: 200, width: 300, border: '1px solid var(--kit-border)' }}>
<div style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ transform: `translateY(${-offset}px)` }}>
{Array.from({ length: 20 }, (_, index) => <div key={index} style={{ height: 40, paddingLeft: 12 }}>Page section {index + 1}</div>)}
</div>
</div>
<Scrollbar label="Page sections" value={offset} max={600} page={200} onChange={setOffset} />
</div>
)
}Props
Scrollbar
A persistent scrollbar for virtual viewports, with proportional thumb, pointer capture and keyboard navigation.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | Accessible name supplied by the editor's locale. |
orientation | 'vertical' | 'horizontal' | 'vertical' | |
valuerequired | number | — | Distance from the start of the content, in the caller's coordinates. |
maxrequired | number | — | Maximum scroll distance (content length minus visible length). |
pagerequired | number | — | Visible content length, in the same coordinates as value. |
onChangerequired | (value: number) => void | — | |
controls | string | — |
Used in
2 of Kition's 16 kits use this component.
Doc
Pdf