An open source design system that's fully customizable and agent ready
TypeScript
fix(Table): preserve width-less column readability (#6807)
Cindy Zhangb2e0ea6cb3e4
diff --git a/.changeset/table-widthless-column-floor.md b/.changeset/table-widthless-column-floor.mdnew file mode 100644index 0000000000..3caa7bbc16--- /dev/null+++ b/.changeset/table-widthless-column-floor.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Table columns without an explicit width now keep a compact readability floor and use the existing horizontal Scroll region when their combined minimums do not fit.++@cixzhangdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 0dc939de66..ff6cbab25f 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -1187,6 +1187,16 @@ jobs:--project chromium \--output empty-state-announcement-output+ # Table merges a consumer min-width with its column floors through CSS+ # max(). jsdom keeps any string, so only a real engine shows whether the+ # emitted declaration parses; an invalid one drops the floors entirely.+ - name: Run Table min-width contract+ run: |+ pnpm exec playwright test \+ packages/core/src/Table/__tests__/TableMinWidth.a11y.chromium.spec.ts \+ --project chromium \+ --output table-min-width-output+# The RichTextEditor "Markdown parity" stories render one Markdown# document with core Markdown and RichTextEditor and measure where each# block lands; geometry, the read/edit switch and the scroll anchor onlydiff --git a/apps/storybook/stories/Table.stories.tsx b/apps/storybook/stories/Table.stories.tsxindex 00a2374fd6..dafc7e67f9 100644--- a/apps/storybook/stories/Table.stories.tsx+++ b/apps/storybook/stories/Table.stories.tsx@@ -1,6 +1,7 @@// Copyright (c) Meta Platforms, Inc. and affiliates.import type {Meta, StoryObj} from '@storybook/react';+import {expect, waitFor} from 'storybook/test';import * as stylex from '@stylexjs/stylex';import {Table,@@ -860,9 +861,10 @@ const mobileColumns: TableColumn<Employee>[] = [* minimums) exceeds the container width. Instead of squishing columns* to illegible widths, the table scrolls horizontally.*- * Each column — even those without an explicit `width` — gets a default- * minimum of 120px, so six columns require at least 720px. In a 320px- * container, the table becomes horizontally scrollable.+ * Each column without an explicit `width` keeps an equal flexible share and a+ * compact 60px readability floor. Six columns therefore require at least 360px:+ * the 320px container scrolls, while the 480px container fits without needless+ * overflow.*/export const ResponsiveScroll: Story = {render: () => (@@ -889,7 +891,7 @@ export const ResponsiveScroll: Story = {</div><div><p style={{margin: '0 0 8px', fontWeight: 600}}>- 480px container — same table, more visible before scroll+ 480px container — same table, no unnecessary scroll</p><divstyle={{@@ -922,6 +924,34 @@ export const ResponsiveScroll: Story = {</div></div>),+ play: async ({canvasElement}) => {+ await document.fonts.ready;+ await new Promise<void>(resolve =>+ requestAnimationFrame(() => requestAnimationFrame(() => resolve())),+ );++ const wrappers = canvasElement.querySelectorAll<HTMLElement>(+ '.astryx-table-scroll-wrapper',+ );+ expect(wrappers).toHaveLength(3);+ const [narrow, medium, wide] = Array.from(wrappers);++ await waitFor(() => {+ expect(narrow).toHaveAttribute('data-scrollable-inline', 'true');+ });+ expect(narrow.scrollWidth).toBeGreaterThan(narrow.clientWidth);+ expect(narrow.querySelector('table')?.style.minWidth).toBe('360px');+ for (const header of narrow.querySelectorAll('th')) {+ expect(header.getBoundingClientRect().width).toBeGreaterThanOrEqual(59);+ }++ for (const fitting of [medium, wide]) {+ await waitFor(() => {+ expect(fitting).not.toHaveAttribute('data-scrollable-inline');+ });+ expect(fitting.scrollWidth).toBeLessThanOrEqual(fitting.clientWidth + 1);+ }+ },};/**diff --git a/packages/core/src/Table/BaseTable.tsx b/packages/core/src/Table/BaseTable.tsxindex 20c1db8db3..fa4153ad2f 100644--- a/packages/core/src/Table/BaseTable.tsx+++ b/packages/core/src/Table/BaseTable.tsx@@ -35,6 +35,7 @@ import {generateColumns,defaultCellRenderer,resolveColumnWidths,+ resolveTableMinWidth,} from './columnUtils';import {TableRow} from './TableRow';import {TableCell} from './TableCell';@@ -511,16 +512,23 @@ function BaseTableInner<T extends Record<string, unknown>>({const hasData = data != null && data.length > 0;const hasColumns = resolvedColumns.length > 0;- // Style precedence: consumer style < the computed column min-width- // (structural — derived from column defs, so it- // must win when present; when absent, a consumer minWidth survives).- const tableStyle: React.CSSProperties = {+ // The table is at least as wide as the column floors require and at least+ // as wide as any minWidth the consumer (or a plugin) set: whichever is+ // larger wins, so column floors never shrink a consumer's minimum.+ const mergedStyle: React.CSSProperties = {...tableRenderProps.htmlProps.style,...style,- ...(resolvedWidths.tableMinWidth > 0- ? {minWidth: `${resolvedWidths.tableMinWidth}px`}- : null),};+ const tableStyle: React.CSSProperties =+ resolvedWidths.tableMinWidth > 0+ ? {+ ...mergedStyle,+ minWidth: resolveTableMinWidth(+ mergedStyle.minWidth,+ resolvedWidths.tableMinWidth,+ ),+ }+ : mergedStyle;let tableElement: ReactNode = (<tablediff --git a/packages/core/src/Table/Table.doc.mjs b/packages/core/src/Table/Table.doc.mjsindex 5f0de0dd6b..966817700c 100644--- a/packages/core/src/Table/Table.doc.mjs+++ b/packages/core/src/Table/Table.doc.mjs@@ -106,7 +106,18 @@ export const docs = {displayName: 'Table',group: 'Table',category: 'Table & List',- keywords: ["table","datatable","datagrid","spreadsheet","sorting","virtualized","columns","rows","selection","pinning"],+ keywords: [+ 'table',+ 'datatable',+ 'datagrid',+ 'spreadsheet',+ 'sorting',+ 'virtualized',+ 'columns',+ 'rows',+ 'selection',+ 'pinning',+ ],playground: {defaults: {data: [@@ -136,22 +147,26 @@ export const docs = {{className: 'astryx-base-table', deprecatedFor: 'table'},],},- description: 'Styled, data-driven table with density, dividers, hover highlight, striped rows, and named plugin support. T must extend Record<string, unknown>.',+ description:+ 'Styled, data-driven table with density, dividers, hover highlight, striped rows, and named plugin support. T must extend Record<string, unknown>.',props: [{name: 'data',type: 'T[]',- description: 'Array of data items to render as rows. T must extend Record<string, unknown> (use `interface MyRow extends Record<string, unknown>` for custom types).',+ description:+ 'Array of data items to render as rows. T must extend Record<string, unknown> (use `interface MyRow extends Record<string, unknown>` for custom types).',},{name: 'columns',type: 'TableColumn<T>[]',- description: 'Column definitions: each column has {key, header, width?, align?, renderCell?}. The `header` field sets the column heading text. If omitted, columns are auto-generated from data object keys. The `width` field is typed as `ColumnWidth` (not a number); use `proportional(n)` or `pixel(n)` helpers imported from `@astryxdesign/core/Table`. Example: `width: pixel(120)` for 120px fixed, `width: proportional(1)` for flex distribution.',+ description:+ 'Column definitions: each column has {key, header, width?, align?, renderCell?}. The `header` field sets the column heading text. If omitted, columns are auto-generated from data object keys. The `width` field is typed as `ColumnWidth` (not a number); use `proportional(n)` or `pixel(n)` helpers imported from `@astryxdesign/core/Table`. Omitting `width` keeps an equal flexible share with a compact 60px readability floor. To give one column a different floor, set `width: proportional(1, {minWidth: 80})`; its `minWidth` replaces the 60px floor for that column. Example: `width: pixel(120)` for 120px fixed, `width: proportional(1)` for a flexible column with a 120px default minimum.',},{name: 'idKey',type: '(keyof T & string) | ((item: T) => string | number)',- description: 'Row key for React reconciliation. Pass a property name string or a function. Falls back to row index if omitted.',+ description:+ 'Row key for React reconciliation. Pass a property name string or a function. Falls back to row index if omitted.',},{name: 'density',@@ -174,46 +189,54 @@ export const docs = {{name: 'hasHover',type: 'boolean',- description: 'Applies a hover highlight background to rows on pointer devices.',+ description:+ 'Applies a hover highlight background to rows on pointer devices.',default: 'false',},{name: 'verticalAlign',type: "'middle' | 'top' | 'bottom'",- description: 'Vertical alignment for body row cells. Controls `vertical-align` on the `<td>` elements.',+ description:+ 'Vertical alignment for body row cells. Controls `vertical-align` on the `<td>` elements.',default: "'middle'",},{name: 'textOverflow',type: "'wrap' | 'truncate'",- description: "How body cell text behaves when it exceeds the column width. 'wrap' lets text wrap and the row grow taller; 'truncate' clips with an ellipsis (default-rendered cells show a tooltip on hover when truncated). Header cells always truncate.",+ description:+ "How body cell text behaves when it exceeds the column width. 'wrap' lets text wrap and the row grow taller; 'truncate' clips with an ellipsis (default-rendered cells show a tooltip on hover when truncated). Header cells always truncate.",default: "'wrap'",},{name: 'plugins',type: 'Record<string, TablePlugin<T>>',- description: 'Named plugins that extend table behavior via the transform pipeline. Converted to an ordered array internally.',+ description:+ 'Named plugins that extend table behavior via the transform pipeline. Converted to an ordered array internally.',},{name: 'rowIndexStart',type: 'number',- description: 'ARIA row index (1-based) for the first rendered body row. The row ordinal is an accessibility concern independent of any visible index column, so setting this (or rowCount) makes the table emit aria-rowindex on body rows and aria-rowcount on the table. For a paginated/windowed view, pass the offset of the first visible row (e.g. (page - 1) * pageSize + 1) so aria-rowindex reflects position in the full dataset. Data-driven mode only.',+ description:+ 'ARIA row index (1-based) for the first rendered body row. The row ordinal is an accessibility concern independent of any visible index column, so setting this (or rowCount) makes the table emit aria-rowindex on body rows and aria-rowcount on the table. For a paginated/windowed view, pass the offset of the first visible row (e.g. (page - 1) * pageSize + 1) so aria-rowindex reflects position in the full dataset. Data-driven mode only.',default: '1',},{name: 'rowCount',type: 'number',- description: 'Total number of body rows across all pages/windows, used for aria-rowcount so assistive tech can announce "row X of Y" against the full dataset. When omitted but rowIndexStart is set (windowed view with an unknown total), aria-rowcount is set to -1 per the ARIA unknown-count convention. Data-driven mode only.',+ description:+ 'Total number of body rows across all pages/windows, used for aria-rowcount so assistive tech can announce "row X of Y" against the full dataset. When omitted but rowIndexStart is set (windowed view with an unknown total), aria-rowcount is set to -1 per the ARIA unknown-count convention. Data-driven mode only.',},{name: 'children',type: 'ReactNode',- description: 'Children mode: compose the table yourself from TableHeader / TableBody / TableFooter, each holding TableRow and TableCell, instead of using data-driven rendering. The children are passed straight to the <table>, so the section is yours to supply. A TableRow placed directly in Table emits <table><tr>, which is invalid HTML and mismatches on hydration (the parser inserts an implied <tbody> for server-rendered markup; React does not on the client). Data-driven mode renders the sections for you.',+ description:+ 'Children mode: compose the table yourself from TableHeader / TableBody / TableFooter, each holding TableRow and TableCell, instead of using data-driven rendering. The children are passed straight to the <table>, so the section is yours to supply. A TableRow placed directly in Table emits <table><tr>, which is invalid HTML and mismatches on hydration (the parser inserts an implied <tbody> for server-rendered markup; React does not on the client). Data-driven mode renders the sections for you.',},{name: 'xstyle',type: 'StyleXStyles',- description: 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.',+ description:+ 'StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.',},],components: [@@ -238,14 +261,46 @@ export const docs = {description:'Table displays structured data in rows and columns with consistent dimensionality. It supports rich cell content, sorting, selection, pagination, and column management through a composable plugin system. Use Table for data sets with uniform structure; for simpler or inconsistent data, consider a list or card layout instead.',bestPractices: [- { guidance: true, description: 'Use density and divider variants to match the information density and scanning needs of your data.' },- { guidance: true, description: 'Compose rich cell content with Astryx components like Badge, StatusDot, and Avatar via renderCell.' },- { guidance: true, description: 'In children mode, put every row inside TableHeader, TableBody, or TableFooter. <table> cannot contain a <tr> directly: the HTML parser inserts an implied <tbody> for server-rendered markup and React does not on the client, so unwrapped rows mismatch on hydration.' },- { guidance: true, description: 'Set explicit width on every column using proportional() or pixel(). proportional(1) gives equal flex distribution with a 120px minimum that prevents columns from collapsing on narrow viewports. Omitting width skips the minimum.' },- { guidance: true, description: 'Use the data-driven API from React Server Components: proportional(), pixel(), and column definitions without function props are server-safe. Columns using renderCell (or any function prop) need the table wrapped in a "use client" component, since functions cannot cross the server-client boundary.' },- { guidance: false, description: 'Use a table for data without consistent columns. Use a list or card layout for heterogeneous content.' },- { guidance: false, description: 'Enable every plugin at once. Add only the features your use case requires to keep the interface focused.' },- { guidance: false, description: 'Omit width on text-heavy columns; without an explicit proportional() width they have no minimum and can squish to near-zero on mobile.' },+ {+ guidance: true,+ description:+ 'Use density and divider variants to match the information density and scanning needs of your data.',+ },+ {+ guidance: true,+ description:+ 'Compose rich cell content with Astryx components like Badge, StatusDot, and Avatar via renderCell.',+ },+ {+ guidance: true,+ description:+ 'In children mode, put every row inside TableHeader, TableBody, or TableFooter. <table> cannot contain a <tr> directly: the HTML parser inserts an implied <tbody> for server-rendered markup and React does not on the client, so unwrapped rows mismatch on hydration.',+ },+ {+ guidance: true,+ description:+ 'Omit width for equal flexible columns with a compact 60px readability floor. Give one column its own floor with proportional(1, {minWidth}), weight columns with proportional(n), and fix widths with pixel(); the Table scroll region activates when the combined floors no longer fit.',+ },+ {+ guidance: true,+ description:+ 'Use the data-driven API from React Server Components: proportional(), pixel(), and column definitions without function props are server-safe. Columns using renderCell (or any function prop) need the table wrapped in a "use client" component, since functions cannot cross the server-client boundary.',+ },+ {+ guidance: false,+ description:+ 'Use a table for data without consistent columns. Use a list or card layout for heterogeneous content.',+ },+ {+ guidance: false,+ description:+ 'Enable every plugin at once. Add only the features your use case requires to keep the interface focused.',+ },+ {+ guidance: false,+ description:+ 'Rely on the 60px omitted-width floor when a text-heavy column needs more room; set proportional(1, {minWidth}) on that column instead.',+ },],anatomy,},@@ -257,10 +312,26 @@ export const docsZh = {description:'Table displays structured data in rows and columns with consistent dimensionality. It supports rich cell content, sorting, selection, pagination, and column management through a composable plugin system. Use Table for data sets with uniform structure; for simpler or inconsistent data, consider a list or card layout instead.',bestPractices: [- { guidance: true, description: 'Use density and divider variants to match the information density and scanning needs of your data.' },- { guidance: true, description: 'Compose rich cell content with Astryx components like Badge, StatusDot, and Avatar via renderCell.' },- { guidance: false, description: 'Use a table for data without consistent columns. Use a list or card layout for heterogeneous content.' },- { guidance: false, description: 'Enable every plugin at once. Add only the features your use case requires to keep the interface focused.' },+ {+ guidance: true,+ description:+ 'Use density and divider variants to match the information density and scanning needs of your data.',+ },+ {+ guidance: true,+ description:+ 'Compose rich cell content with Astryx components like Badge, StatusDot, and Avatar via renderCell.',+ },+ {+ guidance: false,+ description:+ 'Use a table for data without consistent columns. Use a list or card layout for heterogeneous content.',+ },+ {+ guidance: false,+ description:+ 'Enable every plugin at once. Add only the features your use case requires to keep the interface focused.',+ },],anatomy,},@@ -268,20 +339,53 @@ export const docsZh = {/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */export const docsDense = {- description: 'Data-driven table w/ rich cell content via renderCell. Compose cells w/ Badge, StatusDot, Text, Avatar, layout primitives. BaseTable provides unstyled structural core w/ composable plugin pipeline.',+ description:+ 'Data-driven table w/ rich cell content via renderCell. Compose cells w/ Badge, StatusDot, Text, Avatar, layout primitives. BaseTable provides unstyled structural core w/ composable plugin pipeline.',usage: {description:'Table displays structured data in rows and columns with consistent dimensionality. It supports rich cell content, sorting, selection, pagination, and column management through a composable plugin system. Use Table for data sets with uniform structure; for simpler or inconsistent data, consider a list or card layout instead.',bestPractices: [- { guidance: true, description: 'Use density and divider variants to match the information density and scanning needs of your data.' },- { guidance: true, description: 'Compose rich cell content with Astryx components like Badge, StatusDot, and Avatar via renderCell.' },- { guidance: true, description: 'Children mode: wrap rows in TableHeader/TableBody/TableFooter. <table> cannot hold a <tr> directly; the parser adds an implied <tbody> for SSR markup, React does not on the client, so unwrapped rows mismatch on hydration.' },- { guidance: true, description: 'Set explicit width on every column via proportional() or pixel(). proportional(1) = equal flex w/ 120px min preventing collapse on narrow viewports. Omitting width skips the minimum.' },- { guidance: true, description: 'Data-driven API is RSC-safe: proportional(), pixel(), column defs w/o function props work in Server Components. renderCell (any function prop) requires a "use client" wrapper.' },- { guidance: false, description: 'Use a table for data without consistent columns. Use a list or card layout for heterogeneous content.' },- { guidance: false, description: 'Enable every plugin at once. Add only the features your use case requires to keep the interface focused.' },- { guidance: false, description: 'Omit width on text-heavy columns; w/o explicit proportional() width they have no minimum and can squish to near-zero on mobile.' },+ {+ guidance: true,+ description:+ 'Use density and divider variants to match the information density and scanning needs of your data.',+ },+ {+ guidance: true,+ description:+ 'Compose rich cell content with Astryx components like Badge, StatusDot, and Avatar via renderCell.',+ },+ {+ guidance: true,+ description:+ 'Children mode: wrap rows in TableHeader/TableBody/TableFooter. <table> cannot hold a <tr> directly; the parser adds an implied <tbody> for SSR markup, React does not on the client, so unwrapped rows mismatch on hydration.',+ },+ {+ guidance: true,+ description:+ 'Omitted width = equal flex w/ compact 60px readability floor. Per-column floor: proportional(1, {minWidth}). Weighted: proportional(n). Fixed: pixel(). Table scrolls when combined floors do not fit.',+ },+ {+ guidance: true,+ description:+ 'Data-driven API is RSC-safe: proportional(), pixel(), column defs w/o function props work in Server Components. renderCell (any function prop) requires a "use client" wrapper.',+ },+ {+ guidance: false,+ description:+ 'Use a table for data without consistent columns. Use a list or card layout for heterogeneous content.',+ },+ {+ guidance: false,+ description:+ 'Enable every plugin at once. Add only the features your use case requires to keep the interface focused.',+ },+ {+ guidance: false,+ description:+ 'Rely on the 60px omitted-width floor for a text-heavy column that needs more room; set proportional(1, {minWidth}) on it instead.',+ },],anatomy,},-};\ No newline at end of file+};diff --git a/packages/core/src/Table/Table.spec.md b/packages/core/src/Table/Table.spec.mdindex b4d31bc24e..3ef93b4727 100644--- a/packages/core/src/Table/Table.spec.md+++ b/packages/core/src/Table/Table.spec.md@@ -12,6 +12,7 @@ owners: [cixzhang]review_triggers: [public-api, behavior, layout, theming, accessibility]verified_by:[+ apps/storybook/stories/Table.stories.tsx,packages/core/src/Table/Table.test.tsx,packages/core/src/Table/__tests__/TableScroll.a11y.chromium.spec.ts,packages/core/src/Table/Table.perf.test.tsx,@@ -50,11 +51,13 @@ generated anatomy, accessibility, migration, and evidence belong to each listed## Compatibility and migration-- Released default preserved: `no`; a fitting Table scroll region now passes- scrolling to its ancestor and stays out of the keyboard order, while an- overflowing region keeps its existing native scrolling path.-- Compatibility class: standards-conformance bug fix; no public prop, target,- alias, or semantic Table element changes.+- Released default preserved: `no`; data-driven columns with omitted `width`+ keep their equal flexible share plus a compact 60px readability floor rather+ than collapsing toward zero. A column overrides that floor with+ `proportional(value, {minWidth})`. When those floors no longer fit, the existing Table Scroll+ region overflows horizontally. Explicit pixel and proportional widths are unchanged.+- Compatibility class: standards-conformance bug fix; no public prop, target, alias,+ semantic Table element, or Scroll-region behavior changes.- Controlled/uncontrolled behavior: unchanged- Migration decision: `spec:AST-025` FR12, FR14, FR19, FR21, and DEC-1@@ -106,20 +109,21 @@ documented in `Table.doc.mjs` and the member and module docs.## Behavioral and layout contract-| ID | Invariant | Basis | Evidence state |-| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |-| FR1 | By default, Styled Table renders one named Scroll region around one observed content box and one semantic Table. The Scroll region enters the keyboard order and contains inline overscroll only while inline content effectively overflows; fitting content passes scroll gestures to its ancestor. Explicit scroll-wrapper plugin HTML attributes remain authoritative. | `spec:AST-025` FR12, FR14, FR19, FR21; current source, docs, and tests | Verified fitting and inline-overflow transitions through the shared `useScrollableArea` behavior core |-| FR2 | Data-driven mode renders a Body section and a Header section with Column header cells when columns are present. Each data item renders a standard Row and Cells; an empty data array instead renders the configured empty-state row when enabled. It never creates a Footer section. | Current source, docs, and tests | Verified current behavior; no new behavior decided |-| FR3 | Children mode passes caller composition through to the Table. TableHeader, TableBody, and TableFooter provide the respective sections, and TableRow, TableHeaderCell, and TableCell provide standard rows and cells. | Current source, docs, and tests | Verified current composition; no new API or DOM rule |-| FR4 | `Table.doc.mjs` is the canonical aggregate consumer owner for the eight current targets: `table`, `table-scroll-wrapper`, `table-header`, `table-body`, `table-footer`, `table-row`, `table-cell`, and `table-header-cell`. Member docs retain direct lookup metadata through `subComponentOf: 'Table'`. | Current docs and CLI target tests | Verified parent ownership; focused placement coverage is partial |-| FR5 | For a sortable column, useTableSortable renders a Sort control around the column label, an Icon-owned Sort indicator glyph, and a numeric Sort priority only while multi-sort has more than one active entry. | Current source, docs, and tests | Control and priority are tested; glyph presence is source-inspected only |-| FR6 | useTableSelection renders CheckboxInput-owned Selection controls in the generated selection Column header cell and each selectable body Cell; selection remains row state rather than separate anatomy. | Current source, docs, and tests | Verified stable delegated controls; no target or state change |-| FR7 | For an expandable row, useTableRowExpansion renders an Expansion control with an Icon-owned Expansion glyph and conditionally appends an Expanded detail panel whose cell spans the column count captured by that plugin's `transformColumns` step. | Current source, docs, and tests | Verified stable plugin parts; current target gaps remain |-| FR8 | Empty data renders the default compact EmptyState unless the caller supplies replacement content or disables it. | Current source, docs, and tests | Verified conditional delegation; caller content remains outside ownership |-| FR9 | Table converts the caller's named plugin record into one ordered array after its built-in styling plugin. Known names use the current canonical sequence `columnSettings → sort → tree → selection → pagination`; every other name follows that known set while preserving its record insertion order. | Current source and docs | Current shared ordering; canonical-name coverage is source-inspected |-| FR10 | Every applicable non-context transform runs sequentially in the resolved plugin-array order, so a later plugin receives the value returned by every earlier successful plugin. A throwing transform reports a development error and leaves the prior accumulated value in the pipeline. | Current source and tests | Sequential composition is tested; failure isolation is source-inspected |-| FR11 | `transformColumns` completes before element transforms. Table then applies table, header-cell/header-row, body-cell/body-row, scroll-wrapper, and context phases at their render points. Header-cell contributions use `before`, `content`, `after`, `overlay`, and `below` slots. Context transforms run in reverse so the first plugin becomes the outermost provider. | Current source, types, and tests | Transform application is tested; complete cross-phase order is source-inspected |-| FR12 | When built-in and named plugin references are unchanged, Table reuses the resolved plugin array; unknown/custom plugin value identity and insertion order remain stable inputs to memoization. | Current source and performance tests | Current performance contract; focused named-order coverage is partial |+| ID | Invariant | Basis | Evidence state |+| ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |+| FR1 | By default, Styled Table renders one named Scroll region around one observed content box and one semantic Table. The Scroll region enters the keyboard order and contains inline overscroll only while inline content effectively overflows; fitting content passes scroll gestures to its ancestor. Explicit scroll-wrapper plugin HTML attributes remain authoritative. | `spec:AST-025` FR12, FR14, FR19, FR21; current source, docs, and tests | Verified fitting and inline-overflow transitions through the shared `useScrollableArea` behavior core |+| FR2 | Data-driven mode renders a Body section and a Header section with Column header cells when columns are present. Each data item renders a standard Row and Cells; an empty data array instead renders the configured empty-state row when enabled. It never creates a Footer section. | Current source, docs, and tests | Verified current behavior; no new behavior decided |+| FR3 | Children mode passes caller composition through to the Table. TableHeader, TableBody, and TableFooter provide the respective sections, and TableRow, TableHeaderCell, and TableCell provide standard rows and cells. | Current source, docs, and tests | Verified current composition; no new API or DOM rule |+| FR4 | `Table.doc.mjs` is the canonical aggregate consumer owner for the eight current targets: `table`, `table-scroll-wrapper`, `table-header`, `table-body`, `table-footer`, `table-row`, `table-cell`, and `table-header-cell`. Member docs retain direct lookup metadata through `subComponentOf: 'Table'`. | Current docs and CLI target tests | Verified parent ownership; focused placement coverage is partial |+| FR5 | For a sortable column, useTableSortable renders a Sort control around the column label, an Icon-owned Sort indicator glyph, and a numeric Sort priority only while multi-sort has more than one active entry. | Current source, docs, and tests | Control and priority are tested; glyph presence is source-inspected only |+| FR6 | useTableSelection renders CheckboxInput-owned Selection controls in the generated selection Column header cell and each selectable body Cell; selection remains row state rather than separate anatomy. | Current source, docs, and tests | Verified stable delegated controls; no target or state change |+| FR7 | For an expandable row, useTableRowExpansion renders an Expansion control with an Icon-owned Expansion glyph and conditionally appends an Expanded detail panel whose cell spans the column count captured by that plugin's `transformColumns` step. | Current source, docs, and tests | Verified stable plugin parts; current target gaps remain |+| FR8 | Empty data renders the default compact EmptyState unless the caller supplies replacement content or disables it. | Current source, docs, and tests | Verified conditional delegation; caller content remains outside ownership |+| FR9 | Table converts the caller's named plugin record into one ordered array after its built-in styling plugin. Known names use the current canonical sequence `columnSettings → sort → tree → selection → pagination`; every other name follows that known set while preserving its record insertion order. | Current source and docs | Current shared ordering; canonical-name coverage is source-inspected |+| FR10 | Every applicable non-context transform runs sequentially in the resolved plugin-array order, so a later plugin receives the value returned by every earlier successful plugin. A throwing transform reports a development error and leaves the prior accumulated value in the pipeline. | Current source and tests | Sequential composition is tested; failure isolation is source-inspected |+| FR11 | `transformColumns` completes before element transforms. Table then applies table, header-cell/header-row, body-cell/body-row, scroll-wrapper, and context phases at their render points. Header-cell contributions use `before`, `content`, `after`, `overlay`, and `below` slots. Context transforms run in reverse so the first plugin becomes the outermost provider. | Current source, types, and tests | Transform application is tested; complete cross-phase order is source-inspected |+| FR12 | When built-in and named plugin references are unchanged, Table reuses the resolved plugin array; unknown/custom plugin value identity and insertion order remain stable inputs to memoization. | Current source and performance tests | Current performance contract; focused named-order coverage is partial |+| FR13 | In data-driven mode, each explicit column whose `width` is omitted keeps one equal flexible share and a 60px readability floor. A column sets its own floor with `proportional(value, {minWidth})`, which replaces the 60px floor for that column; Table has no table-wide floor setting. Resolution is a pure function of the final column definitions: row values, rendered header/body measurement, locale, sorting, filtering, virtualization, and loading state do not change any floor. Explicit pixel and proportional widths retain their authored floors. When the resolved floors exceed available inline space, the existing Scroll region provides horizontal overflow. | `component:Table/DEC-2`; current source and tests | Verified by width-resolution unit coverage and the ResponsiveScroll real-browser geometry fixture |### Current evidence and gaps@@ -160,15 +164,16 @@ documented in `Table.doc.mjs` and the member and module docs.### Representative states-| State | Required invariant | Allowed variation |-| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |-| Data-driven rows | Scroll region contains Table, Header section when columns exist, Body section, and one standard Row with Cells per data item. | Counts, values, density, dividers, and cell content. |-| Empty data | Body section contains default EmptyState unless replaced or disabled. | Caller replacement content or no empty state. |-| Children mode | Caller-supplied sections are passed directly to Table. | Header, Body, and Footer section presence and content. |-| Sortable column | Column header cell contains Sort control and Sort indicator glyph. | Direction and conditional multi-sort priority. |-| Selectable rows | Selection controls occupy generated header and body cells. | Checked, indeterminate, disabled, or absent per row. |-| Expandable row | Expansion control occupies a generated Cell; open state adds the detail panel after its row using the expansion plugin's captured column count. | Expanded state, caller detail content, and later plugin column transforms. |-| Multiple plugins | Built-in styling runs first, then named plugins compose in the resolved order; later transforms receive earlier results. | Supported transform subset, custom names, and omitted phases. |+| State | Required invariant | Allowed variation |+| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |+| Data-driven rows | Scroll region contains Table, Header section when columns exist, Body section, and one standard Row with Cells per data item. | Counts, values, density, dividers, and cell content. |+| Width-less explicit columns | Every omitted-width column remains equally flexible above a 60px floor; combined floors trigger the existing Scroll region only when they no longer fit. | Row values, header nodes, sorting/filtering, virtualization, loading or empty rows, direction, and responsive container width. |+| Empty data | Body section contains default EmptyState unless replaced or disabled. | Caller replacement content or no empty state. |+| Children mode | Caller-supplied sections are passed directly to Table. | Header, Body, and Footer section presence and content. |+| Sortable column | Column header cell contains Sort control and Sort indicator glyph. | Direction and conditional multi-sort priority. |+| Selectable rows | Selection controls occupy generated header and body cells. | Checked, indeterminate, disabled, or absent per row. |+| Expandable row | Expansion control occupies a generated Cell; open state adds the detail panel after its row using the expansion plugin's captured column count. | Expanded state, caller detail content, and later plugin column transforms. |+| Multiple plugins | Built-in styling runs first, then named plugins compose in the resolved order; later transforms receive earlier results. | Supported transform subset, custom names, and omitted phases. |### Transformation and precedence order@@ -193,6 +198,10 @@ documented in `Table.doc.mjs` and the member and module docs.- **PR2 - Module ownership.** Each module owns any stronger render, allocation,listener, observer, or initialization constraint created by its transforms.Table owns only the common array and transform pipeline cost.+- **PR3 - Static width resolution.** Explicit-column floors resolve in the existing+ O(column count) pass without DOM measurement, observers, extra render passes, or+ dependence on row values. The server and client therefore derive the same inline+ width styles from the same column definitions.## Accessibility contract@@ -301,18 +310,19 @@ aggregate ownership.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| ------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |-| FR1-FR3 | `Table.test.tsx` render, structure, fit/overflow transitions, children-mode, section, and target assertions | Fitting and inline-overflowing data-driven tables, empty data, and children composition | Removing Table, Scroll region, observed content box, conditional keyboard access, or effective-axis containment fails existing role, structure, state, class, style, or prop-forwarding assertions; Row and Cell are conditional on rendered data or caller composition. | `audit:Table/anatomy` |-| FR4 | CLI discovery and API target tests plus source inspection | Direct member docs and unfiltered/scoped target output | Duplicating a parent/member target or changing the canonical owner fails parent-aware discovery assertions; section target placement remains source-inspected. | `audit:Table/theming` |-| FR5 | `plugins/sortable/useTableSortable.test.tsx` plus source inspection | Unsorted, ascending, descending, and multi-sort | Removing the Sort control, conditional priority, or ARIA state fails existing assertions. Removing the Sort indicator glyph does not currently fail a focused test; glyph presence and delegated Icon target placement remain source-inspected. | `audit:Table/anatomy` |-| FR6 | `plugins/selection/useTableSelection.test.tsx` | Select all, individual, disabled, and non-selectable | Removing header/body Selection controls or row selection state fails existing structure, label, interaction, and ARIA assertions; delegated CheckboxInput target placement remains source-inspected. | `audit:Table/anatomy` |-| FR7 | `plugins/rowExpansion/useTableRowExpansion.test.tsx` plus source inspection | Collapsed, expanded, and non-expandable rows | Removing the Expansion control, conditional detail panel, captured-count `colSpan`, or ARIA state fails existing assertions in the covered plugin order; later column transforms, delegated Icon target placement, and untargeted panel wrappers remain source-inspected. | `audit:Table/anatomy` |-| FR8 | `Table.test.tsx` empty-state suite plus EmptyState public target metadata | Default, custom, disabled, and non-empty | Removing conditional empty behavior fails existing assertions; default EmptyState delegation remains source-inspected. | `audit:Table/anatomy` |-| FR9-FR11 | `Table.test.tsx`, `types.ts`, `BaseTable.tsx`, and `useBaseTablePlugins.ts` | Built-in plus known and custom named plugins; every transform phase | Sequential composition, base-before-user behavior, transform application, and slot output have focused coverage; complete known-name sorting, phase order, exception continuation, and context nesting remain source-inspected. | `audit:Table/plugins` |-| FR12, PR1 | `Table.perf.test.tsx` plus `useBaseTablePlugins.ts` source inspection | Same plugin references, recreated record, and changed plugin value | Unchanged plugin values must preserve the resolved array and representative no-op row-update budgets; focused named-record identity coverage remains partial. | `audit:Table/performance` |-| Module backlink | `scripts/check-knowledge.mjs` | Active parent and colocated module record | A missing, duplicate, mis-parented, wrong-kind, misnamed, or undiscovered module record fails knowledge validation. | `audit:Table/modules` |-| Theming anatomy map | `scripts/check-knowledge.mjs`, `themingTargets.test.ts`, and CLI parent-aware target discovery tests | Canonical anatomy, eight current targets, legacy alias | Missing, extra, duplicated, prefixed, stale, alias-backed, or independently owned member mappings fail repository validation or discovery coverage. | `audit:Table/theming` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |+| FR1-FR3 | `Table.test.tsx` render, structure, fit/overflow transitions, children-mode, section, and target assertions | Fitting and inline-overflowing data-driven tables, empty data, and children composition | Removing Table, Scroll region, observed content box, conditional keyboard access, or effective-axis containment fails existing role, structure, state, class, style, or prop-forwarding assertions; Row and Cell are conditional on rendered data or caller composition. | `audit:Table/anatomy` |+| FR4 | CLI discovery and API target tests plus source inspection | Direct member docs and unfiltered/scoped target output | Duplicating a parent/member target or changing the canonical owner fails parent-aware discovery assertions; section target placement remains source-inspected. | `audit:Table/theming` |+| FR5 | `plugins/sortable/useTableSortable.test.tsx` plus source inspection | Unsorted, ascending, descending, and multi-sort | Removing the Sort control, conditional priority, or ARIA state fails existing assertions. Removing the Sort indicator glyph does not currently fail a focused test; glyph presence and delegated Icon target placement remain source-inspected. | `audit:Table/anatomy` |+| FR6 | `plugins/selection/useTableSelection.test.tsx` | Select all, individual, disabled, and non-selectable | Removing header/body Selection controls or row selection state fails existing structure, label, interaction, and ARIA assertions; delegated CheckboxInput target placement remains source-inspected. | `audit:Table/anatomy` |+| FR7 | `plugins/rowExpansion/useTableRowExpansion.test.tsx` plus source inspection | Collapsed, expanded, and non-expandable rows | Removing the Expansion control, conditional detail panel, captured-count `colSpan`, or ARIA state fails existing assertions in the covered plugin order; later column transforms, delegated Icon target placement, and untargeted panel wrappers remain source-inspected. | `audit:Table/anatomy` |+| FR8 | `Table.test.tsx` empty-state suite plus EmptyState public target metadata | Default, custom, disabled, and non-empty | Removing conditional empty behavior fails existing assertions; default EmptyState delegation remains source-inspected. | `audit:Table/anatomy` |+| FR9-FR11 | `Table.test.tsx`, `types.ts`, `BaseTable.tsx`, and `useBaseTablePlugins.ts` | Built-in plus known and custom named plugins; every transform phase | Sequential composition, base-before-user behavior, transform application, and slot output have focused coverage; complete known-name sorting, phase order, exception continuation, and context nesting remain source-inspected. | `audit:Table/plugins` |+| FR12, PR1 | `Table.perf.test.tsx` plus `useBaseTablePlugins.ts` source inspection | Same plugin references, recreated record, and changed plugin value | Unchanged plugin values must preserve the resolved array and representative no-op row-update budgets; focused named-record identity coverage remains partial. | `audit:Table/performance` |+| FR13, PR3 | `Table.test.tsx`, `plugins/columnResize/useTableColumnResize.test.tsx`, `plugins/stickyColumns/useTableStickyColumns.test.tsx`, and `Table.stories.tsx` ResponsiveScroll play assertions | Width-less columns with empty, short, and long-token rows; mixed explicit widths; pinned columns; narrow and fitting containers | Removing the 60px floor, deriving it from row content, changing explicit width semantics, desynchronizing resize bounds or sticky offsets, or preventing the existing Scroll region from activating fails focused unit or real-browser geometry assertions. | `audit:Table/layout` |+| Module backlink | `scripts/check-knowledge.mjs` | Active parent and colocated module record | A missing, duplicate, mis-parented, wrong-kind, misnamed, or undiscovered module record fails knowledge validation. | `audit:Table/modules` |+| Theming anatomy map | `scripts/check-knowledge.mjs`, `themingTargets.test.ts`, and CLI parent-aware target discovery tests | Canonical anatomy, eight current targets, legacy alias | Missing, extra, duplicated, prefixed, stale, alias-backed, or independently owned member mappings fail repository validation or discovery coverage. | `audit:Table/theming` |## Decision log@@ -327,6 +337,19 @@ active only while that axis can scroll, so a fitting Table does not create a deascroll zone for an ancestor. This keeps one Table-owned viewport and adds no publicprop or parallel overflow detector.+### DEC-2 — Width-less explicit columns use a compact static floor++**Reference:** `component:Table/DEC-2`+**Decider:** `cixzhang`, 2026-10-07++A data-driven column with omitted `width` resolves as one flexible share with a+60px minimum. The floor is configured per column: `proportional(value,+{minWidth})` sets that column's floor, and `proportional()` without `minWidth`+keeps its 120px default. Resolution uses only column definitions, so pagination,+sorting, filtering, virtualization, empty and loading states, SSR, and hydration+cannot change any floor. Rejected: deriving the floor from rendered or sampled+content, because it shifts with data and view state.+## Open questionsNone.diff --git a/packages/core/src/Table/Table.test.tsx b/packages/core/src/Table/Table.test.tsxindex 87001bdb1a..c6348d7f71 100644--- a/packages/core/src/Table/Table.test.tsx+++ b/packages/core/src/Table/Table.test.tsx@@ -24,7 +24,9 @@ import {pixel,generateColumns,resolveColumnWidths,+ resolveTableMinWidth,capitalize,+ DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH,DEFAULT_MIN_COLUMN_WIDTH,} from './columnUtils';import type {TablePlugin, TableColumn, ProportionalWidth} from './types';@@ -452,10 +454,63 @@ describe('BaseTable', () => {);});- it('lets a consumer style.minWidth survive when columns compute none', () => {+ it('lets a consumer style.minWidth survive when no columns are resolved', () => {+ render(+ <Table style={{minWidth: '10px'}}>+ <tbody>+ <TableRow>+ <TableCell>Cell</TableCell>+ </TableRow>+ </tbody>+ </Table>,+ );+ expect(screen.getByRole('table').style.minWidth).toBe('10px');+ });++ it('keeps a larger consumer style.minWidth beside width-less column floors', () => {+ const plain: TableColumn<User>[] = [+ {key: 'name'},+ {key: 'age'},+ {key: 'email'},+ {key: 'role'},+ ];+ render(<Table data={users} columns={plain} style={{minWidth: 900}} />);+ expect(screen.getByRole('table').style.minWidth).toBe('900px');+ });++ it.each([+ [undefined, '240px'],+ [900, '900px'],+ [100, '240px'],+ [0, '240px'],+ ['900px', '900px'],+ ['10px', '240px'],+ ['0', '240px'],+ ['0rem', '240px'],+ ['', '240px'],+ ['60rem', 'max(60rem, 240px)'],+ ['50%', 'max(50%, 240px)'],+ ['calc(100% - 2rem)', 'max(calc(100% - 2rem), 240px)'],+ ['var(--table-min)', 'max(var(--table-min), 240px)'],+ ['auto', '240px'],+ ['max-content', '240px'],+ ['min-content', '240px'],+ ['fit-content', '240px'],+ ['inherit', '240px'],+ ['12', '240px'],+ ] as const)(+ 'resolves a consumer minWidth of %j beside a 240px floor to %s',+ (consumer, expected) => {+ expect(resolveTableMinWidth(consumer, 240)).toBe(expected);+ },+ );++ it('raises a smaller consumer style.minWidth to the column floors', () => {const plain: TableColumn<User>[] = [{key: 'name'}, {key: 'age'}];render(<Table data={users} columns={plain} style={{minWidth: '10px'}} />);- expect(screen.getByRole('table').style.minWidth).toBe('10px');+ expect(screen.getByRole('table').style.minWidth).toBe(+ `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH * 2}px`,+ );});it('keeps the astryx theme classes alongside a consumer className', () => {@@ -745,18 +800,70 @@ describe('BaseTable', () => {}});- it('does not apply minWidth on columns with no explicit width', () => {+ it('keeps width-less columns flexible with a compact readability floor', () => {const cols: TableColumn<User>[] = [{key: 'name', header: 'Name'},{key: 'age', header: 'Age'},];render(<BaseTable data={users} columns={cols} />);const headers = screen.getAllByRole('columnheader');- expect(headers[0]).not.toHaveStyle({- minWidth: `${DEFAULT_MIN_COLUMN_WIDTH}px`,+ expect(headers[0]).toHaveStyle({+ width: '50%',+ minWidth: `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH}px`,});- expect(headers[1]).not.toHaveStyle({- minWidth: `${DEFAULT_MIN_COLUMN_WIDTH}px`,+ expect(headers[1]).toHaveStyle({+ width: '50%',+ minWidth: `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH}px`,+ });+ expect(screen.getByRole('table')).toHaveStyle({+ minWidth: `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH * 2}px`,+ });+ });++ it('lets one column set its own floor with proportional minWidth', () => {+ const cols: TableColumn<User>[] = [+ {key: 'name', header: 'Name', width: proportional(1, {minWidth: 96})},+ {key: 'age', header: 'Age', width: proportional(1, {minWidth: 40})},+ {key: 'email', header: 'Email'},+ ];+ render(<BaseTable data={users} columns={cols} />);+ const headers = screen.getAllByRole('columnheader');+ // A larger and a smaller authored floor both replace the 60px default+ // for their own column; the width-less column keeps the compact floor.+ expect(headers[0]).toHaveStyle({minWidth: '96px'});+ expect(headers[1]).toHaveStyle({minWidth: '40px'});+ expect(headers[2]).toHaveStyle({+ minWidth: `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH}px`,+ });+ expect(screen.getByRole('table')).toHaveStyle({+ minWidth: `${Math.max(96, 40, DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH) * 3}px`,+ });+ });++ it('keeps the width-less floor stable when row content changes', () => {+ const cols: TableColumn<User>[] = [+ {key: 'name', header: 'Name'},+ {key: 'age', header: 'Age'},+ ];+ const {rerender} = render(<BaseTable data={[]} columns={cols} />);+ const table = screen.getByRole('table');+ expect(table).toHaveStyle({+ minWidth: `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH * 2}px`,+ });++ rerender(+ <BaseTable+ data={[+ {+ ...users[0],+ name: 'one-unbreakable-token-that-must-not-change-column-sizing',+ },+ ]}+ columns={cols}+ />,+ );+ expect(table).toHaveStyle({+ minWidth: `${DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH * 2}px`,});});diff --git a/packages/core/src/Table/Table.tsx b/packages/core/src/Table/Table.tsxindex f5975c8f6f..07a7653245 100644--- a/packages/core/src/Table/Table.tsx+++ b/packages/core/src/Table/Table.tsx@@ -268,8 +268,9 @@ function TableInner<T extends Record<string, unknown>>({* Combine with Badge (status labels), StatusDot (colored indicators),* Text (formatted values), Avatar (user cells), and HStack/VStack* (multi-element cell layouts). Without renderCell, cells render as plain text.- * Always set explicit width on columns using proportional() or pixel() — omitting- * width skips the minimum width floor, which can cause columns to collapse on mobile.+ * Columns without width remain equally flexible with a compact 60px readability+ * floor. Set one column's floor with proportional(1, { minWidth }), weight+ * columns with proportional(n), and fix widths with pixel().** @example* ```diff --git a/packages/core/src/Table/__tests__/TableMinWidth.a11y.chromium.spec.ts b/packages/core/src/Table/__tests__/TableMinWidth.a11y.chromium.spec.tsnew file mode 100644index 0000000000..71aaa37ffe--- /dev/null+++ b/packages/core/src/Table/__tests__/TableMinWidth.a11y.chromium.spec.ts@@ -0,0 +1,74 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file TableMinWidth.a11y.chromium.spec.ts+ * @input resolveTableMinWidth and real Chromium CSS parsing+ * @output Browser evidence that every emitted table min-width is a valid declaration+ * @position Table integration proof; jsdom keeps invalid strings, so validity is checked here+ */++import {expect, test} from '@playwright/test';+import {resolveTableMinWidth} from '../columnUtils';++// Consumer values a caller can pass as `style.minWidth`, including the+// intrinsic-size and global keywords that CSS max() rejects.+const CONSUMER_VALUES: (number | string | undefined)[] = [+ undefined,+ 900,+ 0,+ '900px',+ '0',+ '0rem',+ '60rem',+ '50%',+ 'calc(100% - 2rem)',+ 'var(--table-min)',+ 'auto',+ 'max-content',+ 'min-content',+ 'fit-content',+ 'inherit',+ 'unset',+ '12',+];++test('every resolved table min-width is a valid CSS declaration', async ({+ page,+}) => {+ await page.setContent('<table></table>');+ for (const consumer of CONSUMER_VALUES) {+ const resolved = resolveTableMinWidth(consumer, 240);+ const accepted = await page.evaluate(value => {+ const table = document.querySelector('table');+ if (!table) {+ throw new Error('missing table');+ }+ table.style.minWidth = '';+ table.style.minWidth = value;+ return table.style.minWidth !== '';+ }, resolved);+ expect(accepted, `${String(consumer)} -> ${resolved}`).toBe(true);+ }+});++test('a keyword consumer minWidth keeps the column floor in layout', async ({+ page,+}) => {+ await page.setContent(+ '<div style="width: 100px"><table style="table-layout: fixed"><tr><td></td></tr></table></div>',+ );+ for (const consumer of ['auto', 'max-content', 'inherit', '0']) {+ const width = await page.evaluate(+ value => {+ const table = document.querySelector('table');+ if (!table) {+ throw new Error('missing table');+ }+ table.style.minWidth = value;+ return table.getBoundingClientRect().width;+ },+ resolveTableMinWidth(consumer, 240),+ );+ expect(width, consumer).toBeGreaterThanOrEqual(240);+ }+});diff --git a/packages/core/src/Table/columnUtils.ts b/packages/core/src/Table/columnUtils.tsindex 8a15b2af61..4d1d831dd3 100644--- a/packages/core/src/Table/columnUtils.ts+++ b/packages/core/src/Table/columnUtils.ts@@ -15,9 +15,28 @@ import type {CSSProperties, ReactNode} from 'react';import type {TableColumn, ProportionalWidth, PixelWidth} from './types';import {firstCharacter} from '../utils/characters';-/** Default minimum width (in px) for proportional columns. */+/** Default minimum width (in px) for explicit proportional columns. */export const DEFAULT_MIN_COLUMN_WIDTH = 120;+/**+ * Compact readability floor (in px) for flexible columns with no width.+ *+ * This is intentionally smaller than the explicit proportional() default:+ * width-less columns remain compact and equal while avoiding near-zero collapse.+ */+export const DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH = 60;++function resolveFlexibleColumnMinWidth(+ width: ProportionalWidth | undefined,+): number {+ return (+ width?.minWidth ??+ (width == null+ ? DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH+ : DEFAULT_MIN_COLUMN_WIDTH)+ );+}+// =============================================================================// Resolved Column Widths// =============================================================================@@ -56,17 +75,24 @@ export interface ResolvedColumnWidths {* @param columns - Resolved column definitions (after auto-generation)* @returns Pre-computed widths for each column and the table minimum width*/-export function resolveColumnWidths<T extends Record<string, unknown>>(- columns: TableColumn<T>[],-): ResolvedColumnWidths {- // --- Pass 1: Categorize columns and compute totals ---+/**+ * Space accounting shared by layout and by plugins that need rendered widths.+ * Flexible columns (width-less or proportional) split `maxProportionalSpace`+ * by proportion; it is the smallest space in which every flexible column+ * still meets its own floor.+ */+interface ColumnSpacePlan {+ totalProportion: number;+ pixelTotal: number;+ maxProportionalSpace: number;+}++function planColumnSpace<T extends Record<string, unknown>>(+ columns: ReadonlyArray<TableColumn<T>>,+): ColumnSpacePlan {let totalProportion = 0;let pixelTotal = 0;- const proportionalCols: {- key: string;- proportion: number;- minWidth: number;- }[] = [];+ const flexibleCols: {proportion: number; minWidth: number}[] = [];for (const col of columns) {const w = col.width;@@ -74,25 +100,108 @@ export function resolveColumnWidths<T extends Record<string, unknown>>(pixelTotal += w.value;} else {const proportion = w?.value ?? 1;- // Only count minWidth for columns that explicitly used proportional().- // Columns with no width set (w === undefined) have no minimum —- // they flex freely and the scroll wrapper handles overflow.- const minW = w != null ? (w.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH) : 0;totalProportion += proportion;- proportionalCols.push({key: col.key, proportion, minWidth: minW});+ flexibleCols.push({+ proportion,+ minWidth: resolveFlexibleColumnMinWidth(w),+ });}}- // --- Pass 2: Compute table min-width ---let maxProportionalSpace = 0;if (totalProportion > 0) {- for (const col of proportionalCols) {+ for (const col of flexibleCols) {const required = (col.minWidth * totalProportion) / col.proportion;if (required > maxProportionalSpace) {maxProportionalSpace = required;}}}+ return {totalProportion, pixelTotal, maxProportionalSpace};+}++/**+ * Inline width (px) of each column while the table sits at its minimum width,+ * which is the width a horizontally overflowing table renders at. Pixel+ * columns keep their value; a flexible column takes its proportional share of+ * the space that satisfies every flexible floor, so a width-less column beside+ * a `proportional()` column can render wider than its own 60px floor.+ */+export function resolveColumnFloorWidths<T extends Record<string, unknown>>(+ columns: ReadonlyArray<TableColumn<T>>,+): Map<string, number> {+ const {totalProportion, maxProportionalSpace} = planColumnSpace(columns);+ const widths = new Map<string, number>();+ for (const col of columns) {+ const w = col.width;+ if (w?.type === 'pixel') {+ widths.set(col.key, w.value);+ } else {+ const proportion = w?.value ?? 1;+ widths.set(+ col.key,+ totalProportion > 0+ ? (maxProportionalSpace * proportion) / totalProportion+ : 0,+ );+ }+ }+ return widths;+}++// A min-width CSS `max()` accepts: a dimension with a known length unit, a+// percentage, or a math/var() expression. Intrinsic-size and global keywords+// (auto, max-content, min-content, fit-content, inherit, ...) and unitless+// non-zero numbers are not lengths and would invalidate the whole declaration.+const MAX_COMPATIBLE_LENGTH =+ /^[+-]?(?:\d+\.?\d*|\.\d+)(?:px|r?em|r?lh|r?ex|r?ch|r?cap|r?ic|vw|vh|vi|vb|vmin|vmax|[sld]v(?:w|h|i|b|min|max)|cq(?:w|h|i|b|min|max)|cm|mm|q|in|pt|pc|%)$/i;+const MAX_COMPATIBLE_FUNCTION = /^(?:calc|min|max|clamp|var)\(/i;+const ZERO_LENGTH = /^[+-]?(?:0+\.?0*|\.0+)(?:[a-z]+|%)?$/i;+const PX_LENGTH = /^(\d+(?:\.\d+)?)px$/i;++/**+ * Inline min-width for a data-driven table: the larger of the column-floor+ * minimum and a min-width the consumer (or a plugin) set.+ *+ * - Numbers, zero, and px lengths compare directly and yield a px value.+ * - Other lengths, percentages, and calc()/var() expressions defer to CSS+ * `max()` so the browser resolves the larger one.+ * - Keywords (auto, max-content, inherit, ...) cannot appear inside `max()`;+ * the column floors win, which keeps every column at its readable minimum.+ */+export function resolveTableMinWidth(+ consumer: CSSProperties['minWidth'],+ floorPx: number,+): string {+ const floor = `${floorPx}px`;+ if (consumer == null) {+ return floor;+ }+ if (typeof consumer === 'number') {+ return `${Math.max(consumer, floorPx)}px`;+ }+ const value = consumer.trim();+ if (value === '' || ZERO_LENGTH.test(value)) {+ return floor;+ }+ const px = PX_LENGTH.exec(value);+ if (px) {+ return `${Math.max(Number(px[1]), floorPx)}px`;+ }+ if (+ MAX_COMPATIBLE_LENGTH.test(value) ||+ MAX_COMPATIBLE_FUNCTION.test(value)+ ) {+ return `max(${value}, ${floor})`;+ }+ return floor;+}++export function resolveColumnWidths<T extends Record<string, unknown>>(+ columns: TableColumn<T>[],+): ResolvedColumnWidths {+ const {totalProportion, pixelTotal, maxProportionalSpace} =+ planColumnSpace(columns);const tableMinWidth = pixelTotal + maxProportionalSpace;// --- Pass 3: Build per-column styles ---@@ -112,13 +221,8 @@ export function resolveColumnWidths<T extends Record<string, unknown>>(if (totalProportion > 0) {style.width = `${(proportion / totalProportion) * 100}%`;}- // Only apply minWidth if the column explicitly used proportional().- // Columns with no width set (w === undefined) have no minimum —- // they flex freely and the scroll wrapper handles overflow.- if (w != null) {- const minW = w.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;- style.minWidth = `${minW}px`;- }+ // Width-less columns stay flexible, but keep a compact readability floor.+ style.minWidth = `${resolveFlexibleColumnMinWidth(w)}px`;}result.set(col.key, {style});@@ -253,9 +357,6 @@ function longestWord(value: unknown): number {return max;}-/** Minimum floor for any column (px). Prevents collapse on narrow viewports. */-const MIN_COLUMN_FLOOR = 60;-/** Scale factor: approximate px per character for min-width calculation. */const PX_PER_CHAR = 8;@@ -309,7 +410,7 @@ export function generateColumns<T extends Record<string, unknown>>(// Min-width: enough to fit header or longest word without wrappingconst minWidth = Math.max(Math.max(m.headerLen, m.maxWordLen) * PX_PER_CHAR,- MIN_COLUMN_FLOOR,+ DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH,);return {diff --git a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.test.tsx b/packages/core/src/Table/plugins/columnResize/useTableColumnResize.test.tsxindex 077c682387..af45525dd4 100644--- a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.test.tsx+++ b/packages/core/src/Table/plugins/columnResize/useTableColumnResize.test.tsx@@ -14,7 +14,11 @@ import userEvent from '@testing-library/user-event';import {Table} from '../../Table';import {useTableColumnResize} from './useTableColumnResize';import {useTableSelection} from '../selection/useTableSelection';-import {proportional, pixel} from '../../columnUtils';+import {+ DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH,+ proportional,+ pixel,+} from '../../columnUtils';import type {TableColumn} from '../../types';// JSDOM doesn't implement pointer capture@@ -703,6 +707,15 @@ describe('useTableColumnResize', () => {expect(handle).toHaveAttribute('aria-valuemin', '60');});+ it('uses the compact flexible floor for a width-less column', () => {+ render(<ResizeTable />);+ const handle = getResizeHandles()[0];+ expect(handle).toHaveAttribute(+ 'aria-valuemin',+ String(DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH),+ );+ });+it('defaults to DEFAULT_MIN_COLUMN_WIDTH (120) for proportional without explicit minWidth', () => {const defaultColumns: TableColumn<TestItem>[] = [{key: 'name', header: 'Name', width: proportional(1)},diff --git a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsx b/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsxindex 12f744663e..ce81ddaefc 100644--- a/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsx+++ b/packages/core/src/Table/plugins/columnResize/useTableColumnResize.tsx@@ -22,7 +22,10 @@ import type {TableColumn,ColumnWidth,} from '../../types';-import {DEFAULT_MIN_COLUMN_WIDTH} from '../../columnUtils';+import {+ DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH,+ DEFAULT_MIN_COLUMN_WIDTH,+} from '../../columnUtils';import {observeResize} from '../../../utils/sharedResizeObserver';// =============================================================================@@ -96,7 +99,8 @@ const KEYBOARD_LARGE_STEP = 50;* Derive the effective minimum width for a column based on its width config.* - Proportional columns: use their declared minWidth (default 120px)* - Pixel columns: use their declared value (you set 200px, min is 200px)- * - No width / unknown: use DEFAULT_MIN_COLUMN_WIDTH+ * - No width: use the compact flexible-column floor (60px)+ * - Unknown: use the legacy 50px fallback** A global override (from config.minWidth) takes precedence when set.*/@@ -108,7 +112,7 @@ function resolveColumnMinWidth(return globalOverride;}if (!colWidth) {- return DEFAULT_MIN_COLUMN_WIDTH;+ return DEFAULT_FLEXIBLE_COLUMN_MIN_WIDTH;}if (colWidth.type === 'proportional') {return colWidth.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;diff --git a/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx b/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsxindex ceedc02cbf..ab9f70245e 100644--- a/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx+++ b/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.test.tsx@@ -17,7 +17,7 @@ import {describe, it, expect} from 'vitest';import {render, screen} from '@testing-library/react';import {Table} from '../../Table';import {useTableStickyColumns} from './useTableStickyColumns';-import {pixel} from '../../columnUtils';+import {pixel, proportional} from '../../columnUtils';import type {TableColumn} from '../../types';// =============================================================================@@ -89,6 +89,60 @@ describe('useTableStickyColumns', () => {expect(getHeader('Email').style.insetInlineStart).toBe('180px');});+ it('uses the width-less floor for cumulative pinned offsets', () => {+ const widthLessColumns: TableColumn<Row>[] = [+ {key: 'name', header: 'Name'},+ {key: 'email', header: 'Email'},+ {key: 'team', header: 'Team'},+ ];++ function Harness() {+ const sticky = useTableStickyColumns<Row>({+ startKeys: ['name', 'email'],+ });+ return (+ <Table+ data={data}+ columns={widthLessColumns}+ idKey="id"+ plugins={{stickyColumns: sticky}}+ />+ );+ }++ render(<Harness />);+ expect(getHeader('Name').style.insetInlineStart).toBe('0px');+ expect(getHeader('Email').style.insetInlineStart).toBe('60px');+ });++ it('offsets a pinned column by the rendered width of a width-less neighbor', () => {+ // At overflow the table sits at its minimum width (3 × 120px here), so the+ // width-less Name column renders at 120px, not its own 60px floor.+ const mixedColumns: TableColumn<Row>[] = [+ {key: 'name', header: 'Name'},+ {key: 'email', header: 'Email', width: proportional(1)},+ {key: 'team', header: 'Team', width: proportional(1)},+ ];++ function Harness() {+ const sticky = useTableStickyColumns<Row>({+ startKeys: ['name', 'email'],+ });+ return (+ <Table+ data={data}+ columns={mixedColumns}+ idKey="id"+ plugins={{stickyColumns: sticky}}+ />+ );+ }++ render(<Harness />);+ expect(getHeader('Name').style.insetInlineStart).toBe('0px');+ expect(getHeader('Email').style.insetInlineStart).toBe('120px');+ });+it('pins an end column at inset-inline-end: 0', () => {function Harness() {const sticky = useTableStickyColumns<Row>({endKeys: ['status']});diff --git a/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx b/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsxindex a4f1cf708a..dc4e56e919 100644--- a/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx+++ b/packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx@@ -23,7 +23,7 @@ import type {BodyCellRenderProps,ScrollWrapperRenderProps,} from '../../types';-import {DEFAULT_MIN_COLUMN_WIDTH} from '../../columnUtils';+import {resolveColumnFloorWidths} from '../../columnUtils';// =============================================================================// Config@@ -56,23 +56,10 @@ export interface UseTableStickyColumnsConfig {// Width helpers// =============================================================================-/**- * Resolve a column's pixel width for cumulative offset math. Mirrors the- * resize plugin's fallback so offsets line up with rendered widths:- * pixel columns use their value; proportional columns use their declared- * minWidth (or the default); unknown widths use the default.- */-function getColumnWidth(col: TableColumn<Record<string, unknown>>): number {- const w = col.width;- if (!w) {- return DEFAULT_MIN_COLUMN_WIDTH;- }- if (w.type === 'pixel') {- return w.value;- }- // proportional- return w.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;-}+// Pinned offsets only matter while the table overflows, and an overflowing+// table renders at its minimum width. Offsets therefore accumulate the widths+// Table layout gives each column at that width (resolveColumnFloorWidths), so a+// pinned block stays contiguous for pixel, proportional, and width-less mixes./*** Columns pinned to the START edge → cumulative inline offset (px). The pinned@@ -95,11 +82,12 @@ function computeStartOffsets(if (lastStickyIndex === -1) {return null;}+ const widths = resolveColumnFloorWidths(columns);const offsets = new Map<string, number>();let cumulative = 0;for (let i = 0; i <= lastStickyIndex; i++) {offsets.set(columns[i].key, cumulative);- cumulative += getColumnWidth(columns[i]);+ cumulative += widths.get(columns[i].key) ?? 0;}return offsets;}@@ -126,11 +114,12 @@ function computeEndOffsets(if (firstStickyIndex === -1) {return null;}+ const widths = resolveColumnFloorWidths(columns);const offsets = new Map<string, number>();let cumulative = 0;for (let i = columns.length - 1; i >= firstStickyIndex; i--) {offsets.set(columns[i].key, cumulative);- cumulative += getColumnWidth(columns[i]);+ cumulative += widths.get(columns[i].key) ?? 0;}return offsets;}diff --git a/packages/core/src/Table/types.ts b/packages/core/src/Table/types.tsindex ee936beabe..bd6b93e36c 100644--- a/packages/core/src/Table/types.ts+++ b/packages/core/src/Table/types.ts@@ -115,15 +115,18 @@ export interface TableColumn<T extends Record<string, unknown>> {* Enforces a 120px minimum width to prevent squishing on narrow viewports.* - `proportional(2)` — gets twice the space of `proportional(1)`.* - `pixel(200)` — fixed 200px width.- * - Omitted — treated as `proportional(1)` for distribution, but with **no**- * minimum width. Prefer explicit `proportional(1)` for text-heavy columns- * so they don't collapse on mobile.+ * - Omitted — treated as `proportional(1)` for distribution with a compact+ * 60px readability floor. It stays flexible and expands to fill available+ * space.+ * - `proportional(1, { minWidth: 80 })` — sets this column's own floor; its+ * `minWidth` replaces the 60px omitted-width floor and the 120px default.** @example* ```* { key: 'name', header: 'Name', width: proportional(1) }* { key: 'bio', header: 'Bio', width: proportional(2) }* { key: 'age', header: 'Age', width: pixel(80) }+ * { key: 'id', header: 'ID', width: proportional(1, { minWidth: 80 }) }* ```*/width?: ColumnWidth;