Skip to content

feat: add full-width column resizing example#6233

Open
govindarajug wants to merge 1 commit intoTanStack:mainfrom
govindarajug:feat/full-width-column-resizing-example
Open

feat: add full-width column resizing example#6233
govindarajug wants to merge 1 commit intoTanStack:mainfrom
govindarajug:feat/full-width-column-resizing-example

Conversation

@govindarajug
Copy link
Copy Markdown

Summary

Adds a new React example (column-resizing-full-width) that demonstrates how to make a TanStack Table fill its container width, with the last column automatically stretching to fill remaining space while keeping all columns individually resizable.

This is a commonly requested pattern — several open issues describe the challenge of making tables fill their container width with proper resize behavior:

How it works

  1. ResizeObserver tracks the container width reactively
  2. getColumnWidth() computes each column's width — if total columns width < container width, the last column stretches to fill the gap
  3. CSS variables (--col-{id}-size) are used for performant resize rendering (same pattern as column-resizing-performant example)
  4. Table width is set to Math.max(totalColumnsWidth, containerWidth) so it always fills the container

Key features

  • Table always fills container width
  • Last column stretches to fill remaining space
  • Individual columns remain resizable with min/max constraints
  • Responsive to window/container resize
  • Double-click column border to reset size
  • Debug state panel shows live sizing info

Test plan

  • Columns fill the container width on initial render
  • Resizing a column causes the last column to adjust
  • When total column width exceeds container, horizontal scroll appears
  • Double-click a column resizer resets that column's size
  • Resizing the browser window causes the table to adapt
  • Works with columnResizeMode: 'onChange'

Adds a new React example demonstrating how to make a table fill its
container width with the last column stretching to occupy remaining
space. Columns remain individually resizable while maintaining the
full-width behavior. Uses ResizeObserver for responsive container
tracking and CSS variables for performant resize rendering.

This addresses a common use case discussed in TanStack#4825, TanStack#4880, TanStack#5120,
and TanStack#5870 where users need tables that fill their container width
with proper resize behavior.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 61433ad6-5d88-4d94-a154-5b5f244c6d5a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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