Skip to content

Commit 9bf4005

Browse files
committed
fix(Table): pass variant to calculateColumns for radio styling
Fixes radio button padding in compact variant tables by ensuring the variant prop is passed to calculateColumns in the deprecated Table component. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8b528bb commit 9bf4005

3 files changed

Lines changed: 800 additions & 28 deletions

File tree

packages/react-table/src/deprecated/components/Table/Table.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ class Table extends Component<TableProps, {}> {
253253
actionsToggle,
254254
onFavorite,
255255
canSortFavorites,
256+
variant,
256257
// order of columns: Collapsible | Selectable | Favoritable
257258
firstUserColumnIndex: [onCollapse, onSelect, onFavorite].filter((callback) => callback).length
258259
});

packages/react-table/src/deprecated/components/Table/__tests__/Table.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,25 @@ describe('Table', () => {
279279
expect(asFragment()).toMatchSnapshot();
280280
});
281281

282+
test('Compact table with Radio select', () => {
283+
const onSelect: OnSelect = () => undefined;
284+
const { asFragment } = render(
285+
<Table
286+
aria-label="Compact table with radio"
287+
variant={TableVariant.compact}
288+
selectVariant={RowSelectVariant.radio}
289+
onSelect={onSelect}
290+
cells={columns}
291+
rows={rows}
292+
>
293+
<TableHeader />
294+
<TableBody />
295+
</Table>
296+
);
297+
298+
expect(asFragment()).toMatchSnapshot();
299+
});
300+
282301
test('Control text table', () => {
283302
const controlTextColumns: ICell[] = [
284303
{ ...(columns[0] as object), transforms: [nowrap] },

0 commit comments

Comments
 (0)