DitherCharts

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

  1. 09:00 Revenue chart exported
  2. 09:30 Legend moved to the right
  3. 10:00 Series renamed to Signups
  4. 10:30 Gridlines hidden
  5. 11:00 Dither cell set to 3px
  6. 11:30 Tooltip format changed
  7. 12:00 Y axis starts at zero
  8. 12:30 Dark theme checked
  9. 13:00 Bar gap widened
  10. 13:30 Annotation added at Q3
  11. 14:00 Colors swapped for ink
  12. 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.

ScrollArea props
PropTypeDefaultDescription
orientationType "vertical" | "horizontal" | "both"Default –Which way the content scrolls. Default "vertical". Give the area a height (or width) to scroll within.
labelType stringDefault –Names the area for screen readers, which then list it as a region.
childrenType ReactNodeDefault –