Layout primitives

Bounded overflow

<forma-bounded-overflow>

A contained scroll region for genuinely wide content so the page itself never scrolls horizontally.

Authoring tag
<forma-bounded-overflow>
Behavior owner
Native CSS
Canonical source
patterns/bounded-overflow.html

Purpose

Bounded overflow wraps content that cannot reflow, such as a wide table, a long log line or a timeline, in a region that scrolls on its own. The page keeps its width, so everything else still reflows at 320px and 400% zoom (WCAG 1.4.10 allows two-dimensional scrolling only for content that needs it). Scrolling is native: the browser supplies scrollbars, touch panning and keyboard scrolling once the region is focusable. Scroll chaining to the page is stopped at the edges, and the scrollbar gutter is reserved so content does not jump when a scrollbar appears.

Use when

  • A data table has more columns than fit on a phone and must keep its row and column relationships.
  • Preformatted content (logs, code, identifiers) must not wrap.
  • A long list should scroll inside a fixed height in a dense dashboard panel.

Avoid when

  • The content can reflow: use Grid, Stack or wrapping text instead of adding a scrollbar.
  • The data needs sorting, selection or cell navigation: use Data grid.
  • You want side-by-side comparison of options with a sticky first column: use Comparison grid.
  • Code samples on site pages: the Code sample block already handles its own overflow.

Behavior to know

  • overflow: auto scrolls in whichever direction the content exceeds the region.
  • overscroll-behavior: contain stops a swipe at the region's edge from scrolling the page.
  • scrollbar-gutter: stable reserves scrollbar space to prevent layout shift.

Basic example

The smallest correct markup: the canonical pattern from patterns/bounded-overflow.html inside its public tag. Copy this first, then adapt labels, names and state.

Canonical

Minimal bounded overflow

Rendered from the canonical pattern file.

RegionQ1Q2Q3Q4Year
North America1,204,0001,318,5001,402,2501,511,0005,435,750
Europe904,100931,0001,010,4001,120,9003,966,400
HTML · Minimal bounded overflow Raw HTML for HTML · Minimal bounded overflow
<forma-bounded-overflow class="forma-component-tag">
<div class="forma-bounded-overflow" role="region" aria-label="Quarterly totals by region" tabindex="0">
  <table>
    <thead><tr><th scope="col">Region</th><th scope="col">Q1</th><th scope="col">Q2</th><th scope="col">Q3</th><th scope="col">Q4</th><th scope="col">Year</th></tr></thead>
    <tbody>
      <tr><th scope="row">North America</th><td>1,204,000</td><td>1,318,500</td><td>1,402,250</td><td>1,511,000</td><td>5,435,750</td></tr>
      <tr><th scope="row">Europe</th><td>904,100</td><td>931,000</td><td>1,010,400</td><td>1,120,900</td><td>3,966,400</td></tr>
    </tbody>
  </table>
</div>
</forma-bounded-overflow>

Click or tap the code once to select all of it, then copy.

Examples

Scenario

Wide ledger table

A seven-column ledger in a focusable, named scroll region. On narrow screens the table scrolls horizontally inside the region while the page stays put; the caption and row headers keep the data understandable while scrolled.

Open invoices, September 2026
InvoiceCustomerIssuedDueAmountPaidStatus
INV-2291Northwind Logistics2026-09-012026-09-18$12,400.00$0.00Overdue
INV-2304Contoso Pharmacy2026-09-082026-10-08$3,150.00$1,000.00Partly paid
INV-2317Fabrikam Manufacturing2026-09-152026-10-15$48,900.00$0.00Sent
HTML · Wide ledger table Raw HTML for HTML · Wide ledger table
<forma-bounded-overflow class="forma-component-tag">
  <div class="forma-bounded-overflow" role="region" aria-labelledby="bounded-overflow-wide-ledger-caption" tabindex="0">
    <table class="forma-dense-ledger">
      <caption id="bounded-overflow-wide-ledger-caption">Open invoices, September 2026</caption>
      <thead><tr><th scope="col">Invoice</th><th scope="col">Customer</th><th scope="col">Issued</th><th scope="col">Due</th><th scope="col">Amount</th><th scope="col">Paid</th><th scope="col">Status</th></tr></thead>
      <tbody>
        <tr><th scope="row">INV-2291</th><td>Northwind Logistics</td><td>2026-09-01</td><td>2026-09-18</td><td>$12,400.00</td><td>$0.00</td><td>Overdue</td></tr>
        <tr><th scope="row">INV-2304</th><td>Contoso Pharmacy</td><td>2026-09-08</td><td>2026-10-08</td><td>$3,150.00</td><td>$1,000.00</td><td>Partly paid</td></tr>
        <tr><th scope="row">INV-2317</th><td>Fabrikam Manufacturing</td><td>2026-09-15</td><td>2026-10-15</td><td>$48,900.00</td><td>$0.00</td><td>Sent</td></tr>
      </tbody>
    </table>
  </div>
</forma-bounded-overflow>

Click or tap the code once to select all of it, then copy.

Scenario

Bounded deployment log

Unwrapped log lines in a region capped at 10rem tall with an inline max-block-size. The region scrolls in both directions; the dashboard around it keeps its height and width.

Deployment 7.3.2 log

09:40:02 build   payments-api@7.3.2 compiled in 84.1s (cache hit ratio 0.92)
09:40:15 push    registry.example.com/payments/payments-api:7.3.2-4f2a91c pushed
09:40:31 deploy  rolling update started: 0/12 pods ready, maxUnavailable=1, maxSurge=2
09:41:10 deploy  6/12 pods ready
09:41:52 deploy  12/12 pods ready
09:41:53 verify  health check /healthz returned 200 on all pods
09:42:05 verify  synthetic checkout test passed in 612ms
09:42:06 done    deployment 7.3.2 completed
HTML · Bounded deployment log Raw HTML for HTML · Bounded deployment log
<forma-bounded-overflow class="forma-component-tag">
  <section class="forma-surface forma-stack" data-density="compact" aria-labelledby="bounded-overflow-bounded-log-title">
    <h2 id="bounded-overflow-bounded-log-title">Deployment 7.3.2 log</h2>
    <div class="forma-bounded-overflow" style="max-block-size: 10rem" role="region" aria-label="Deployment 7.3.2 log output" tabindex="0">
      <pre><code>09:40:02 build   payments-api@7.3.2 compiled in 84.1s (cache hit ratio 0.92)
09:40:15 push    registry.example.com/payments/payments-api:7.3.2-4f2a91c pushed
09:40:31 deploy  rolling update started: 0/12 pods ready, maxUnavailable=1, maxSurge=2
09:41:10 deploy  6/12 pods ready
09:41:52 deploy  12/12 pods ready
09:41:53 verify  health check /healthz returned 200 on all pods
09:42:05 verify  synthetic checkout test passed in 612ms
09:42:06 done    deployment 7.3.2 completed</code></pre>
    </div>
  </section>
</forma-bounded-overflow>

Click or tap the code once to select all of it, then copy.

Mobile

Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.

Mobile example

Mobile table scroll

A four-column schedule on a phone. The table is wider than the screen, so only the bounded region scrolls horizontally; headings and text around it still reflow.

Viewport width

Frames narrower than the selected width show the component at the width available.

What changes at narrow widths

  • The region is max-inline-size: 100%, so it is never wider than the screen; the table scrolls inside it with a swipe.
  • Horizontal swipes that reach the table's edge do not scroll or navigate the page because overscroll is contained.
  • The region is focusable (tabindex="0"), so people using a hardware keyboard with a tablet can scroll it with the arrow keys.
  • In landscape the table may fit and the scrollbar disappears; the reserved gutter prevents a layout jump.
HTML · Mobile table scroll Raw HTML for HTML · Mobile table scroll
<forma-bounded-overflow class="forma-component-tag">
  <div class="forma-bounded-overflow" role="region" aria-labelledby="bounded-overflow-mobile-table-scroll-caption" tabindex="0">
    <table class="forma-dense-ledger">
      <caption id="bounded-overflow-mobile-table-scroll-caption">On-call schedule, week 40</caption>
      <thead><tr><th scope="col">Engineer</th><th scope="col">Primary shift</th><th scope="col">Secondary shift</th><th scope="col">Escalation contact</th></tr></thead>
      <tbody>
        <tr><th scope="row">Mateo Alvarez</th><td>Mon 09:00 – Wed 09:00 UTC</td><td>Thu 09:00 – Fri 18:00 UTC</td><td>Payments team lead</td></tr>
        <tr><th scope="row">Priya Raman</th><td>Wed 09:00 – Fri 18:00 UTC</td><td>Mon 09:00 – Tue 18:00 UTC</td><td>Platform duty manager</td></tr>
      </tbody>
    </table>
  </div>
</forma-bounded-overflow>

Click or tap the code once to select all of it, then copy.

Baseline

Mobile · 320px

The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.

Viewport width

Frames narrower than the selected width show the component at the width available.

API and configuration

Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.

Native and ARIA attributes
AttributeOnValuesDefaultDescription
tabindex.forma-bounded-overflow0—Makes the scroll region focusable so keyboard users can scroll it. Required when the content has no focusable elements.
role.forma-bounded-overflowregion—Exposes the focusable scroll region as a named region, so focus lands on something with a role and name.
aria-label.forma-bounded-overflowstring—Names the region when there is no caption to reference.
aria-labelledby.forma-bounded-overflowid of the table caption—Names the region from the table caption.
style.forma-bounded-overflowmax-block-size: <length>—Caps the height to make the region scroll vertically as well.
scopethcol | row—Associates header cells with their column or row so scrolled cells stay understandable.
CSS hooks (derived from dist/all.css)
HookKindValues or defaultDescription
.forma-bounded-overflowBlock class—Scroll container: max-inline-size: 100%, overflow: auto, overscroll-behavior: contain, scrollbar-gutter: stable. Draws no border or background.
Keyboard interaction
KeysResult
Tab / Shift+TabMoves focus to the region (when tabindex="0") and then into any focusable content.
Arrow keysScroll the focused region horizontally and vertically. Native browser behavior.
Page Up / Page Down, Home / EndScroll the focused region by a page or to its start or end. Native browser behavior.
Events
EventDescription
scrollNative scroll event on the region. Forma does not use it.

Form behavior

Not a form control.

States

Bounded overflow states
StateHow it is expressedPresentation
Fitscontent no larger than the regionNo scrollbar; the gutter space is still reserved where the platform shows classic scrollbars.
Scrollablecontent wider or taller than the regionNative scrollbars appear; the page does not scroll with the content.
Focused:focus-visibleThe shared Forma focus ring outlines the region.

Accessibility

Forma provides

  • Keeps horizontal scrolling inside the region, so the rest of the page reflows at 320px (WCAG 1.4.10).
  • Contains overscroll, so a swipe at the table edge does not trigger page scrolling or back navigation.
  • Focused regions use the standard Forma focus indicator.

Your application supplies

  • Add tabindex="0", role="region" and an accessible name so keyboard and screen-reader users can find and scroll the region.
  • Use table captions and th scope so data stays understandable while scrolled.
  • Only bound content that truly cannot reflow; prefer wrapping for text.

Responsive behavior

  • Always fits its parent's width; the content inside decides whether scrolling happens.
  • No breakpoints: at wide widths the same table often fits and no scrollbar appears.
  • Set max-block-size when vertical containment is also needed, for example in dashboard panels.
  • Works inside grids and sidebars because it cannot widen its track.

Motion

  • No animation: scrolling is native and follows the user's input. Forma's reduced-motion rule sets scroll-behavior: auto, so programmatic smooth scrolling is disabled for users who prefer reduced motion.

Usage guidance

Do

  • Keep the first column meaningful (row headers) so users know which row they are on while scrolled.
  • Name the region after its content.

Avoid

  • Wrapping entire pages or layouts in bounded overflow to hide reflow problems.
  • Nesting scroll regions inside each other.

Verification specimens

Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.