Files
kemal.earth ff9ff456cd feat(design-system): updated trace ui components (#54389)
## Problem

The `Trace` primitives in `ui-patterns` only supported panning and
zooming through the minimap, and had no way to show summary facts about
a trace. Using them for a real trace view in Unified Logs needs direct
manipulation on the waterfall itself, a resizable span column for long
span names, and a place to put trace-level stats.

Part 1 of 3. This PR is design-system only — nothing in Studio consumes
it yet.

## Solution

**Direct manipulation on the waterfall**

- Drag across the timeline to pan, wheel to zoom around the pointer.
Panning only starts past a small threshold, so a drag never selects the
row it ends on.
- `Trace.Scrubber` follows the pointer with the offset from the trace
start.
- The span column is resizable by a focusable separator: drag it, nudge
with the arrow keys, or jump to its bounds with Home and End. The
timeline is kept above a minimum width so the tree can't be dragged over
it.

**Minimap**

- Dragging outside the brush now selects a new window. Dragging the
brush still pans and dragging an edge still resizes; a plain click
outside still recentres.

**New parts**

- `Trace.Summary` / `Trace.SummaryItem`, with `Trace.TotalDuration`,
`Trace.SpanCount` and `Trace.Depth` as values.

**Visual**

- Leaf rows get an elbow connecting them to their parent's guide, so the
tree reads as a tree rather than floating dots.
- Minor ruler ticks between the labelled ones, and a shorter ruler,
which also shortens the span header.

**One breaking change:** `Trace.Minimap` is now passed to
`Trace.Waterfall`'s `minimap` prop instead of being a child, so it sits
outside the area that handles pointer gestures. Both demos and the docs
page are updated to match; these are the only consumers in the repo.

## Review instructions

1. Open the design-system preview and go to **UI Patterns → Tracing**.
2. On the first demo, drag left and right across the timeline to pan,
and scroll to zoom — the zoom should stay anchored under the pointer.
3. Drag a span bar and release on it. It should pan, not select the row.
4. Drag the divider between the span column and the timeline. Then tab
to it and use the arrow keys, Home and End — the handle should move from
where it appears, and End should reach the far edge.
5. Move the pointer across the timeline and confirm the scrubber line
tracks it with a readable offset.
6. Check the summary strip above the waterfall shows Duration, Depth and
Total Spans.
7. On the minimap: drag the brush to pan, drag an edge to resize, drag
outside the brush to select a new window, and click outside it to
recentre. Zoom all the way in and confirm the brush stays wide enough to
grab.
8. Scroll the docs page and confirm the code sample matches what the
demos actually do.
2026-12-02 14:24:52 +00:00
..

Supabase Design System

Design resources for building consistent user experiences at Supabase.

Getting started

From the repo root:

# Copy local env vars (sets NEXT_PUBLIC_BASE_PATH for asset URLs)
cp apps/design-system/.env.local.example apps/design-system/.env.local
# Move into the design-system app
cd apps/design-system
# Install dependencies
pnpm i
# Build the registry and Velite content, then start the dev servers
pnpm dev

Or from apps/design-system:

# Copy local env vars (sets NEXT_PUBLIC_BASE_PATH for asset URLs)
cp .env.local.example .env.local
# Install dependencies
pnpm i
# Build the registry and Velite content, then start the dev servers
pnpm dev

The dev command builds the registry and Velite content, then runs the Next.js dev server and Velite watcher in parallel.

Open http://localhost:3003/design-system in your browser to see the result.

Doc pages load compiled MDX from .velite/codes/*.json per document. Metadata lives in the smaller allDocs.json index (~367KB instead of ~27MB), so content edits only reload the changed doc's code.

Alternative commands

pnpm dev runs through Turborepo: it builds the registry and content, then starts the Next.js development server and the Velite content watcher together. You can run the prerequisite steps on their own:

pnpm build:registry
pnpm build:content

From the repo root, pnpm dev:design-system runs the same dev script.

Watching for MDX changes

The dev command watches MDX files and hot-reloads them. To run only the watcher, use pnpm dev:content.

Adding components

The design system references components rather than housing them. That distinction matters: everything below is about documenting components, not implementing them. Add or edit the components themselves in one of these two places:

After you add or remove documented components, update these source files:

  • config/docs.ts: list of components in the sidebar
  • content/docs: the component documentation
  • registry/examples.ts: example components
  • registry/fragments.ts: fragment components
  • registry/charts.ts: chart components
  • registry/copy-writing.ts: copywriting examples
  • registry/default/example/*: the example component implementations
  • registry/default/block/*: chart block implementations, when you add a chart

Do not edit __registry__. pnpm dev, pnpm typecheck, and pnpm build generate it from the files above, and it is gitignored. If you add registry entries while the app is already running, regenerate it:

cd apps/design-system
pnpm build:registry