You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an opt-in, container-width based mode for the column hide prop, using CSS container queries. The existing viewport-based hide ('sm' | 'md' | 'lg' | number) stays the default and is not replaced.
Current behavior
hide is implemented with viewport media queries (@media (max-width: 599px) → .rdt_hideOnSm, etc. in DataTable.css). Columns hide based on the window width, regardless of how wide the table itself is. This is valid, intentional behavior for the common case and existing consumers depend on it.
Problem
A table in a narrow panel (sidebar, split view, dashboard card) keeps all columns even when cramped, because the window is wide. There's currently no way to make hide respond to the table's own width instead of the window's.
Demos or previews that simulate a narrow viewport with a constrained container (like the docs mobile demo) can't exercise the real prop, since the media query looks at the window. The docs currently fake it with omit.
Proposed change (for discussion)
Introduce a table-level opt-in prop, e.g. responsive: 'viewport' | 'container', defaulting to 'viewport' (current behavior, unchanged).
When set to 'container':
Mark the table's scroll container (or root) as a container-type: inline-size query container.
Generate @container (max-width: …) rules for .rdt_hideOnSm/Md/Lg at the same breakpoints (599px / 959px / 1279px), parallel to (not replacing) the existing @media rules.
This is additive: nothing changes for consumers who don't set responsive: 'container', so it can ship in a minor release.
Considerations
container-type creates a new containment context; verify no interaction with position: sticky pinned columns and the fixed header.
The query container should be chosen so horizontal overflow, sticky columns, fixed headers, and pagination are not unintentionally contained.
Visual tests should resize the table independently of the viewport in sidebar, full-width, sticky, and nested-container layouts.
Browser support: baseline since 2023; document the floor.
Numeric hide: N breakpoints are tracked separately in Numeric hide breakpoint values are a no-op #1346 (currently a no-op even in viewport mode) — that fix should land before or alongside this so 'container' mode doesn't inherit the same gap.
Out of scope for this issue: other viewport-based mobile styles (row height, cell padding, pagination compacting). Can be a follow-up if there's demand once container-based hide ships.
Summary
Add an opt-in, container-width based mode for the column
hideprop, using CSS container queries. The existing viewport-basedhide('sm' | 'md' | 'lg' | number) stays the default and is not replaced.Current behavior
hideis implemented with viewport media queries (@media (max-width: 599px)→.rdt_hideOnSm, etc. inDataTable.css). Columns hide based on the window width, regardless of how wide the table itself is. This is valid, intentional behavior for the common case and existing consumers depend on it.Problem
hiderespond to the table's own width instead of the window's.omit.Proposed change (for discussion)
Introduce a table-level opt-in prop, e.g.
responsive: 'viewport' | 'container', defaulting to'viewport'(current behavior, unchanged).When set to
'container':container-type: inline-sizequery container.@container (max-width: …)rules for.rdt_hideOnSm/Md/Lgat the same breakpoints (599px / 959px / 1279px), parallel to (not replacing) the existing@mediarules.This is additive: nothing changes for consumers who don't set
responsive: 'container', so it can ship in a minor release.Considerations
container-typecreates a new containment context; verify no interaction withposition: stickypinned columns and the fixed header.hide: Nbreakpoints are tracked separately in Numeric hide breakpoint values are a no-op #1346 (currently a no-op even in viewport mode) — that fix should land before or alongside this so'container'mode doesn't inherit the same gap.hideships.