Skip to content

Commit

Permalink
Add renderExtraHeadRows prop to StandardTable, allows one or severa… (#…
Browse files Browse the repository at this point in the history
…774)

- Add renderExtraHeadRows prop to StandardTable, allows one or several extra th rows in header, below ordinary header.
  • Loading branch information
mattias800 committed Sep 2, 2024
1 parent dc2547d commit cee24f7
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,25 @@ export interface StandardTableProps<
onSortOrderChange?: StandardTableOnSortOrderChange<TColumnKey>;

/**
* If set, this will always show below <th> and above first <tr>.
* This row is 100% custom, and inherits no design or functionality from StandardTable.
* You must make sure that extraHeaderRow root is a <tr> and contains <td> elements.
* If set, this will always show inside <thead>, below last <th>.
* This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable.
* You must make sure that renderExtraHeadRows root is one or several <th> elements.
* You must also make sure that it has correct number of cells, with correct padding, etc.
*/
renderExtraHeadRows?: () => ReactNode;

/**
* If set, this will always show inside <tbody>, above first <tr>.
* This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable.
* You must make sure that extraHeaderRow root is a <tr>.
* You must also make sure that it has correct number of cells, with correct padding, etc.
*/
renderExtraRowTop?: () => ReactNode;

/**
* If set, this will always show below last <tr>.
* This row is 100% custom, and inherits no design or functionality from StandardTable.
* You must make sure that extraHeaderRow root is a <tr> and contains <td> elements.
* This row is 100% custom, shown as is, and inherits no design or functionality from StandardTable.
* You must make sure that extraHeaderRow root is a <tr>.
* You must also make sure that it has correct number of cells, with correct padding, etc.
*/
renderExtraRowBottom?: () => ReactNode;
Expand All @@ -175,6 +183,7 @@ export const StandardTable = function StandardTable<
variant = "standard",
onKeyDown,
onSortOrderChange,
renderExtraHeadRows,
...props
}: StandardTableProps<TItem, TColumnKey, TColumnGroupKey>) {
const generatedTableId = useId();
Expand Down Expand Up @@ -313,6 +322,7 @@ export const StandardTable = function StandardTable<
items={props.items}
height={"var(--current-row-height)"}
/>
{renderExtraHeadRows?.()}
</thead>
<StandardTableContent
variant={variant}
Expand Down

0 comments on commit cee24f7

Please sign in to comment.