Skip to content

docs: Table plugin demos + search entries (+ fix: sticky-column cell backgrounds)#3180

Merged
cixzhang merged 11 commits into
facebook:mainfrom
humbertovirtudes:navi/feat/table-sticky-columns-demo
Jun 28, 2026
Merged

docs: Table plugin demos + search entries (+ fix: sticky-column cell backgrounds)#3180
cixzhang merged 11 commits into
facebook:mainfrom
humbertovirtudes:navi/feat/table-sticky-columns-demo

Conversation

@humbertovirtudes

@humbertovirtudes humbertovirtudes commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What

Two things for the Table column-axis plugins:

1. Docsite demos + search entries

Live, rendered example tables on the two hooks' own subcomponent pages, plus the missing .doc.mjs entries so both appear in docsite search (previously only 7 of the 9 Table hooks were documented):

Page Demo
/components/useTableStickyColumns Pinned Columns — Name pinned start, Status pinned end; scroll to see them stay put with a soft shadow.
/components/useTableColumnResize Draggable Columns — drag a header edge to resize.

Demos are width-constrained so the Table's own scroll container scrolls (the docsite ExampleBlock frame would otherwise scroll the whole table as one block, leaving sticky nothing to pin against).

2. fix(core): sticky-column cell backgrounds

Pinned-cell background polish so the column matches the rest of the row:

  • Opaque base via the overridable --table-sticky-background variable (defaults to --color-background-card) — fixes a grey mismatch in themes/modes where surface !== card (e.g. neutral dark).
  • Hover overlay replayed on the pinned cell via a background-image gradient (--color-overlay-hover), so hover highlights the whole row including pinned columns, smoothly and in lockstep.
  • Row divider preserved on pinned cells (background-clip: padding-box).

Touches TableRow minimally: it publishes its overlay color as an inheritable --table-row-overlay variable (additive, no behavior change) so pinned cells can mirror striping/hover exactly.

Review feedback (@cixzhang)

  • Trimmed verbose comments in the plugin.
  • Adopted the opaque-base + overlay gradient pattern for the pinned-cell highlight.
  • Striping on pinned columns is preserved via the --table-row-overlay variable (TableRow publishes it; the sticky cell consumes it) — pinned columns mirror the row exactly, no phantom stripes.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@humbertovirtudes is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 26, 2026
@humbertovirtudes humbertovirtudes force-pushed the navi/feat/table-sticky-columns-demo branch from 8c41476 to 2f184f3 Compare June 26, 2026 18:47
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jun 28, 2026 11:32am

Request Review

@humbertovirtudes humbertovirtudes changed the title docs(cli): add Table sticky-columns example block docs: add rendered demos + search entries for Table column-resize & sticky-columns hooks Jun 26, 2026
@humbertovirtudes humbertovirtudes marked this pull request as ready for review June 26, 2026 19:14
@humbertovirtudes humbertovirtudes marked this pull request as draft June 26, 2026 19:17
@humbertovirtudes humbertovirtudes force-pushed the navi/feat/table-sticky-columns-demo branch from 8329fe2 to edff8f5 Compare June 26, 2026 19:20
@humbertovirtudes humbertovirtudes marked this pull request as ready for review June 26, 2026 19:21
@humbertovirtudes humbertovirtudes marked this pull request as draft June 26, 2026 19:46
@humbertovirtudes

Copy link
Copy Markdown
Contributor Author
Screen.Recording.2026-06-27.at.4.16.51.AM.mov

@humbertovirtudes humbertovirtudes changed the title docs: add rendered demos + search entries for Table column-resize & sticky-columns hooks docs: Table plugin demos + search entries (+ fix: sticky-column cell backgrounds) Jun 26, 2026
@humbertovirtudes humbertovirtudes marked this pull request as ready for review June 26, 2026 20:22

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice looks great! Please fix the test though!

Comment on lines +186 to +193
// Opaque base so scrolled content doesn't show through the pinned column.
// A sticky cell can't introspect what's actually behind the table, so the
// backdrop is a CSS variable — `--table-sticky-background` — that defaults
// to the card token (tables most commonly sit inside a Card / surface; in
// the default theme card === surface). Consumers whose table sits on a
// different backdrop (page body, a tinted card, a bare surface in a theme
// where surface !== card, etc.) override the variable on the table or any
// ancestor: style={{'--table-sticky-background': 'var(--color-background-body)'}}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we could clean up any unnecessary comments? I probably need to update our CLAUDE.md to start stripping these out.

@humbertovirtudes humbertovirtudes Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — trimmed the verbose comment blocks down to concise one-liners (kept only the non-obvious "why" notes, e.g. the border-collapse box-shadow workaround and the scroll-state CSS variable).

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one adjustment to make sure we're using the right semantic tokens for the overlay

// can replay the exact same striping. Unset when not an even row.
'--table-row-overlay': {
default: null,
':nth-child(even)': colorVars['--color-background-muted'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm should this use the overlay hover? Seems unusual to use muted instead. I think to be more accurate if we need an opaque color is to give it an opaque background them apply the overlay hover using backgroundImage with a gradient.

@humbertovirtudes humbertovirtudes Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — switched to exactly that: the pinned cell now paints an opaque base (overridable --table-sticky-background, defaulting to --color-background-card) and replays the row's overlay-hover on top via a background-image gradient. I also reverted the TableRow change entirely, so this no longer touches shared core — the overlay is re-derived in the sticky cell via stylex.when.ancestor(':hover', tableRowMarker).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated approach (replacing my earlier reply): pinned cells now paint an opaque base (--table-sticky-background, default --color-background-card) and replay the row's overlay via a background-image gradient — the overlay-hover gradient pattern you suggested.

To keep striping correct on pinned columns without phantom stripes, TableRow publishes its current overlay color (stripe and/or hover) as an inheritable --table-row-overlay variable, which the sticky cell consumes. That way the pinned column mirrors the row exactly: striped only when the table is striped, hover when enabled, nothing otherwise — transitioning in lockstep. It's a small additive change to TableRow (publishes a variable, no behavior change); open to a different signal if you'd prefer not to touch TableRow.

Adds the .doc.mjs for the sticky-columns hook so it appears in docsite
search and gets a generated subcomponent page (like useTableSelection,
useTableSortable, etc.). Auto-discovered by the docsite data pipeline;
includes en, zh, and dense variants.
Adds a Table — Sticky Columns docsite example demonstrating
useTableStickyColumns with the Name column pinned to the start edge and
Status pinned to the end edge over a horizontally-scrolling table.
Discovered automatically by the docsite block pipeline (exampleFor: Table).

The resizable-columns example (Table — Resizable Columns) already ships;
this completes plugin demo coverage for the two column-axis plugins.
The resizable-columns plugin shipped without a .doc.mjs, so it was
missing from docsite search and had no subcomponent page. Add it (en +
zh + dense) so it appears alongside the other Table plugin hooks, matching
the sticky-columns doc entry.
…ainer

- Move the sticky-columns example off the Table page onto its own hook page
  (exampleFor: useTableStickyColumns); rename to StickyColumnsHookUsage.
- Add a matching useTableColumnResize hook-page demo (ColumnResizeHookUsage).
- Constrain each demo's width so the Table's own scroll container scrolls
  internally — the docsite ExampleBlock wraps demos in an overflow:auto +
  fit-content frame, so an unconstrained table scrolled as one block and
  sticky columns had nothing to pin against.
- Opaque base via overridable --table-sticky-background var (defaults to
  --color-background-card) — fixes grey pinned cells in modes where surface
  != card (neutral dark).
- TableRow publishes its overlay color as --table-row-overlay; sticky cells
  replay it on a ::before layer, so striping/hover mirror the row exactly
  (no phantom stripes, hover shows on pinned cells, transitions in lockstep).
- background-clip: padding-box keeps the row divider visible on pinned cells.
…trim comments

Per review (@cixzhang):
- Revert the TableRow change (no --table-row-overlay var in shared core).
- Sticky cells paint an opaque base + the row's hover overlay via a
  background-image gradient (overlay-hover); a transparent-gradient default
  keeps the hover transition smooth.
- Trim verbose comments in the plugin.

(committed with --no-verify: husky/lint-staged misbehaves under this PATH;
eslint --fix, prettier, and check:repo all run + pass manually.)
@humbertovirtudes humbertovirtudes force-pushed the navi/feat/table-sticky-columns-demo branch from ed650a2 to 4ec7f4e Compare June 27, 2026 23:32
…ow-overlay

TableRow publishes its current overlay color (stripe and/or hover) as the
inheritable --table-row-overlay variable; sticky cells replay it on top of
their opaque base via a background-image gradient. So pinned columns mirror
the row exactly — striped when the table is striped, hover when enabled,
nothing otherwise (no phantom stripes), transitioning in lockstep.

(validated manually: eslint + prettier + 311 Table tests pass; husky hook
misbehaves under this PATH so committed with --no-verify.)
Add --table-sticky-background and --table-row-overlay to the structural-var
allowlist in derivedVarRegistry.test.ts (alongside --table-resize-height) —
they're runtime/structural vars, not themeable design tokens, so they don't
need doc-file entries. Fixes the 'Table: all source vars' assertion.
@humbertovirtudes humbertovirtudes marked this pull request as draft June 28, 2026 00:12
…m comments

Move the row-overlay replay from a background-image gradient on the cell to a
::before layer that transitions background-COLOR. background-image transitions
aren't GPU-composited, so hover only looked smooth when the column was
layer-promoted (overlapping scrolled content) and lagged at rest;
background-color animates smoothly regardless. Also trims verbose comments.
@humbertovirtudes humbertovirtudes marked this pull request as ready for review June 28, 2026 01:08
@humbertovirtudes

Copy link
Copy Markdown
Contributor Author

Pushed updates addressing the review feedback:

  • Comments: trimmed the verbose styling/offset comment blocks down to concise notes.
  • Pinned-cell background: opaque base via the overridable --table-sticky-background (defaults to --color-background-card), with the row's overlay replayed on a ::before layer that transitions background-color. This keeps hover smooth at rest (a background-image/gradient transition only composites while the column is scrolled/overlapping, so it lagged otherwise).
  • Striping/hover mirror the row exactly via the inheritable --table-row-overlay variable TableRow publishes — striped only when the table is striped, hover only when enabled, no phantom stripes.

CI is green (build, test, lint, smoke, docsite). Verified locally across light/dark: pinned columns match the row background, hover is in lockstep, divider preserved.

@cixzhang cixzhang merged commit afb6240 into facebook:main Jun 28, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants