Skip to content

Commit adfdf1b

Browse files
authored
feat: support custom TableHeaderRow via components prop (#436)
Add TableHeaderRow to the customizable `components` prop, allowing consumers to replace the default header row renderer. Bump version to 2.1.0 to fix #310
1 parent 53c5af0 commit adfdf1b

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## v2.1.0 (2026-04-16)
4+
5+
- feat: add `TableHeaderRow` to customizable `components` prop, allowing custom header row rendering
6+
37
## v2.0.0 (2026-04-16)
48

59
### Breaking Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-base-table",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "a react table component to display large data set with high performance and flexibility",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

src/BaseTable.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const getContainerStyle = (width: number, maxWidth: number, height: number): Rea
5858
const DEFAULT_COMPONENTS: Record<string, React.ComponentType<any>> = {
5959
TableCell,
6060
TableHeaderCell,
61+
TableHeaderRow,
6162
ExpandIcon,
6263
SortIndicator,
6364
};
@@ -862,8 +863,8 @@ class BaseTable extends React.PureComponent<BaseTableProps, BaseTableState> {
862863
expandColumnKey: this.props.expandColumnKey,
863864
expandIcon: this._getComponent('ExpandIcon'),
864865
};
865-
866-
return <TableHeaderRow {...headerProps} />;
866+
const TableHeaderRowComp = this._getComponent('TableHeaderRow');
867+
return <TableHeaderRowComp {...headerProps} />;
867868
}
868869

869870
renderHeaderCell({ columns, column, columnIndex, headerIndex, expandIcon }: any) {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export type SortState = Record<string, SortOrderValue>;
135135
export interface TableComponents {
136136
TableCell?: React.ElementType;
137137
TableHeaderCell?: React.ElementType;
138+
TableHeaderRow?: React.ElementType;
138139
ExpandIcon?: React.ElementType;
139140
SortIndicator?: React.ElementType;
140141
}

0 commit comments

Comments
 (0)