Scroll area
Updated
ScrollArea is native overflow in a 2px ink frame with pixel scrollbars drawn in CSS: a solid ink thumb on a 25% dithered track. The browser does the scrolling, so touch, wheel and keyboard all work as usual; Firefox gets a thin ink scrollbar instead. Like the charts, it takes your theme's ink and paper, light or dark, and needs no Tailwind.
Example
- 09:00 Revenue chart exported
- 09:30 Legend moved to the right
- 10:00 Series renamed to Signups
- 10:30 Gridlines hidden
- 11:00 Dither cell set to 3px
- 11:30 Tooltip format changed
- 12:00 Y axis starts at zero
- 12:30 Dark theme checked
- 13:00 Bar gap widened
- 13:30 Annotation added at Q3
- 14:00 Colors swapped for ink
- 14:30 Dashboard shared with the team
JanFebMarAprMayJunJulAugSepOctNovDec
import "@/components/dithercharts/controls.css"
import { ScrollArea } from "@/components/dithercharts/scroll-area"
// Give it a height to scroll within; the label makes it a named region.
<ScrollArea label="Activity" className="h-48">
{entries.map((entry) => <p key={entry.id}>{entry.text}</p>)}
</ScrollArea>
<ScrollArea label="Months" orientation="horizontal">
<div className="flex w-max gap-3 p-4">{months}</div>
</ScrollArea>Install
Controls install with DitherCharts Pro. See Installation to log in, then import controls.css once, e.g. in your root layout.
npx dithercharts add scroll-area
Props
It renders a native element, so every other attribute that element takes passes through.
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | Type "vertical" | "horizontal" | "both" | Default – | Which way the content scrolls. Default "vertical". Give the area a height (or width) to scroll within. |
| label | Type string | Default – | Names the area for screen readers, which then list it as a region. |
| children | Type ReactNode | Default – |

