Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add renderExtraHeadRows prop to StandardTable, allows one or severa… #774

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading