{% extends "base.html" %} {% import "components/macros.html" as ui %} {% block title %}Tables & Scroll Sync - Design System Wiki{% endblock %} {% block content %}
{% include "docs/sidebar.html" %}
Layout & Navigation

Tables & Scroll Sync

A standardized container macro for horizontal scroll synchronization and scrollbar-fitting layout. It resolves the common usability issue of unreachable scrollbars on wide tables.

Container Showcase

The macro standardizes the background styling, shadows, rounded borders, vertical height bounds, sticky headers, and outputs a synced scrollbar clone that rests at the top of the table.

{{ ui::table_container_open(id="docs-demo-table", has_top_scroll=true, max_height="250px") }}
ID Code Full Name Position Title Base Office Current Shift Status Actions & Config
#001_a9f Arthur Dent Sandwich Maker Space Station 4 ACTIVE
#002_c3d Tricia McMillan Reporter / Anchor Sector 12 Office ON DUTY
#003_e5f Ford Prefect Researcher Betelgeuse V TRAVELING
#004_g7h Zaphod Beeblebrox Ex-President Heart of Gold SUSPENDED
{{ ui::table_container_close(id="docs-demo-table", has_top_scroll=true) }}

How It Works

Top Scroll Sync Logic

Since HTML natively positions horizontal scrollbars only at the bottom of overflow elements, the component generates a custom dummy scroll container at the top of the table. A Javascript listener observes layout resizing and syncs the horizontal offsets of both the top scroll track and the main table scroll track dynamically.

Rounded Corner Clipping Fix

To prevent scrollbars from clipping at the corners of high-radius panels (like Shadcn's rounded-3xl panels), the border and shadow styling are kept on the outer wrapper, while the overflow scroll boundary is restricted to an inner container with slightly smaller radius adjustments (rounded-[22px]).

{% endblock %}