Skip to content

feat: hide and pin columns - #34

Open
SyedSibtainRazvi wants to merge 3 commits into
mainfrom
feat/column-hiding-pinning
Open

SyedSibtainRazvi wants to merge 3 commits into
mainfrom
feat/column-hiding-pinning

Conversation

@SyedSibtainRazvi

@SyedSibtainRazvi SyedSibtainRazvi commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Etiquettes of raising a PR

PR reviews are a way to request peers to give feedback on the code that is going
to the mainline. This means, that PR should be in a reviewable state. Please ensure
that the following checkboxes are ticked. If any of them are not ticked, then
the PR is not ready for review

  • Did you test changes locally?
  • Did you check PR contents after opening the PR

Related issue

  • Feature request: hide a column, and pin a column, for sheets with many columns.

Functionalities added or changed

  • Header menu: enableColumnHiding and enableColumnPinning on Sheet give each header a "…" menu with Pin column, Unpin column and Hide column. Both are off by default.
  • SheetColumnsMenu: a new export. It's a "Columns" button with a checklist that shows hidden columns again, for the app's own toolbar.
  • Pinning:
    • TanStack's columnPinningFeature is now registered.
    • Columns pinned to the start stay in view as the sheet scrolls sideways, in left-to-right and right-to-left layouts.
    • The row numbers stay in view while any column is pinned.
    • The menu pins only columns outside a group.
  • Focus:
    • After a column is hidden, focus moves to the next column's menu button. After pinning or unpinning, it stays on the button.
    • Tabbing to a cell or control under the pinned columns scrolls it clear of them.
    • Focusing or clicking inside a pinned cell doesn't scroll the sheet.
  • Reordering: a pinned column has no move grip and doesn't take drops, because pinning orders it first anyway.
  • Fix: in TanStack v9, getVisibleLeafColumns() ignores pinning order, while the headers and cells follow it. The grid tracks are now built from the start, center and end lists, so the widths land on the right columns.
  • Row tints: the row tint (hover, open, highlight) is now a CSS variable, --sheet-row-tint, registered in styles.css. Pinned cells paint it over an opaque background, so the columns scrolling underneath don't show through.

Additional info

  • Docs: checked against TanStack v9.3.1's type definitions and its v9 pinning and visibility guides.
  • Not breaking. Without the new props or pinning state, the sheet looks and behaves as before.
  • Start only: columns pinned to the end with TanStack's API come last but still scroll. The README says so.
  • Tests:
    • Unit tests cover the menu items, pinning, unpinning, hiding and showing again, pinned columns being fixed for reordering, and the track order. The track-order test fails without the fix.
    • E2E tests cover hiding and restoring with focus, and a pinned column holding its place past one viewport of scroll, in both directions.
    • They also check that resizing a pinned column moves the next pinned one, focus after pinning and unpinning, and that focus scrolls clear of the pinned columns but not for a pinned cell. The last test fails without the fix.
  • Known gaps:
    • The add-row "+" button scrolls away sideways, while the row numbers above it stay.
    • In SheetColumnsMenu, a column with header: '' shows an empty label.
  • Checks: lint, test, build, typecheck, e2e (axe at zero), publint, format, sync, knip and the forced tsc --build all pass.
  • Playground: the sorting demo has both props and a Columns menu, and Title starts pinned.

Checklist

  • Tests
  • Translations
  • Documentation
  • Uploaded screenshots
  • Verified on preview url once

Screenshots

Screenshot 2026-12-03 at 5 34 44 PM Screenshot 2026-12-03 at 5 34 09 PM

Page(s) if applicable

See the "Sorting and row actions" demo in the playground. Narrow the window, then scroll sideways.

@SyedSibtainRazvi SyedSibtainRazvi self-assigned this Dec 3, 2026
@SyedSibtainRazvi
SyedSibtainRazvi force-pushed the feat/column-hiding-pinning branch 2 times, most recently from 0e601ed to 0851fbc Compare December 3, 2026 12:16
Register TanStack's column pinning and keep start-pinned columns in view
with sticky cells. Add enableColumnHiding and enableColumnPinning, which
give each header a menu to pin, unpin or hide its column, and
SheetColumnsMenu, a checklist to show hidden columns again.
@SyedSibtainRazvi
SyedSibtainRazvi force-pushed the feat/column-hiding-pinning branch from 0851fbc to 633ab35 Compare December 3, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant