Skip to content

ScrollArea

A region that scrolls on its own, with a soft shadow on the side where more is hidden. The page around it stays still.

import { ScrollArea } from '@sypnia/ui/react'

On this page
  1. A log
  2. A strip wider than the screen
  3. When to use it
  4. For everyone
  5. Props

A log

The shadow at the bottom says there is more; it moves to the top as you scroll. Pure CSS: no script measures anything.

12:00:04  GET /api/orders/1000  200  20 ms
12:01:04  GET /api/orders/1001  200  57 ms
12:02:04  GET /api/orders/1002  200  94 ms
12:03:04  GET /api/orders/1003  200  41 ms
12:04:04  GET /api/orders/1004  200  78 ms
12:05:04  GET /api/orders/1005  200  25 ms
12:06:04  GET /api/orders/1006  200  62 ms
12:07:04  GET /api/orders/1007  200  99 ms
12:08:04  GET /api/orders/1008  200  46 ms
12:09:04  GET /api/orders/1009  200  83 ms
12:10:04  GET /api/orders/1010  200  30 ms
12:11:04  GET /api/orders/1011  200  67 ms
12:12:04  GET /api/orders/1012  200  104 ms
12:13:04  GET /api/orders/1013  200  51 ms
12:14:04  GET /api/orders/1014  200  88 ms
12:15:04  GET /api/orders/1015  200  35 ms
12:16:04  GET /api/orders/1016  200  72 ms
12:17:04  GET /api/orders/1017  200  109 ms
12:18:04  GET /api/orders/1018  200  56 ms
12:19:04  GET /api/orders/1019  200  93 ms
12:20:04  GET /api/orders/1020  200  40 ms
12:21:04  GET /api/orders/1021  200  77 ms
12:22:04  GET /api/orders/1022  200  24 ms
12:23:04  GET /api/orders/1023  200  61 ms
12:24:04  GET /api/orders/1024  200  98 ms
12:25:04  GET /api/orders/1025  200  45 ms
12:26:04  GET /api/orders/1026  200  82 ms
12:27:04  GET /api/orders/1027  200  29 ms
12:28:04  GET /api/orders/1028  200  66 ms
12:29:04  GET /api/orders/1029  200  103 ms
12:30:04  GET /api/orders/1030  200  50 ms
12:31:04  GET /api/orders/1031  200  87 ms
12:32:04  GET /api/orders/1032  200  34 ms
12:33:04  GET /api/orders/1033  200  71 ms
12:34:04  GET /api/orders/1034  200  108 ms
12:35:04  GET /api/orders/1035  200  55 ms
12:36:04  GET /api/orders/1036  200  92 ms
12:37:04  GET /api/orders/1037  200  39 ms
12:38:04  GET /api/orders/1038  200  76 ms
12:39:04  GET /api/orders/1039  200  23 ms
Code
import { ScrollArea } from '@sypnia/ui/react';

const lines = Array.from({ length: 40 }, (_, i) => `12:${String(i).padStart(2, '0')}:04  GET /api/orders/${1000 + i}  200  ${20 + ((i * 37) % 90)} ms`);
export default function Log() {
  return (
    <div style={{ border: '1px solid var(--line)', borderRadius: 'var(--r-3)' }}>
      <ScrollArea label="Request log" maxHeight="12rem">
        <pre style={{ margin: 0, padding: 'var(--s-3) var(--s-4)', fontSize: 'var(--text-xs)' }}>{lines.join('\n')}</pre>
      </ScrollArea>
    </div>
  );
}

A strip wider than the screen

axis="x": the strip scrolls inside itself, so the page never scrolls sideways.

checkoutpaymentsorderssearchmobilebillinginvoicesauthemailwebhookscronexports
Code
import { Chip, ScrollArea } from '@sypnia/ui/react';

const tags = ['checkout', 'payments', 'orders', 'search', 'mobile', 'billing', 'invoices', 'auth', 'email', 'webhooks', 'cron', 'exports'];
// A strip that may be wider than the screen scrolls inside itself, never the page.
export default function Strip() {
  return (
    <ScrollArea label="Tags" axis="x">
      <div className="sy-row sy-row--nowrap" style={{ padding: 'var(--s-2) 0' }}>{tags.map((t) => <Chip key={t}>{t}</Chip>)}</div>
    </ScrollArea>
  );
}

When to use it

Use it when

  • Long content that must stay inside a fixed height: a log, a list in a panel, a preview.
  • A strip of chips or tabs that may be wider than a phone.

Do not use it when

  • The whole page would scroll anyway: let it.
  • A table on phones: tables become cards there.

For everyone

  • It is a named region that takes focus, so keyboard users can scroll it with the arrow keys.
  • The shadows are decoration; nothing is announced.

Props

ScrollAreaTypeDefault
labelrequired

What is inside, for screen readers: the area can be focused, so the keyboard can scroll it.

string
axis

'y': up and down (default). 'x': sideways, for a strip that must not break the page.

"x" | "y" y
className string
maxHeight

The tallest it gets before it scrolls, as CSS. Default 20rem.

string
  1. A log
  2. A strip wider than the screen
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms