How to add a custom class to a specific column header <th> tag? #4824
Answered
by
talatkuyuk
richcoleman-alphatrust
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
talatkuyuk
Apr 27, 2023
Replies: 1 comment 2 replies
-
You can add a property for the class name into column declare module "@tanstack/table-core" {
interface ColumnMeta<TData extends RowData, TValue> {
className?: string;
}
} Then, you can define a className for the column that you want: columnHelper.accessor("options", {
cell: // your implementation,
header: // your implementation,
footer: // your implementation,
meta: {
className: "classname-for-the-options-column",
},
}), Then, you can get it through the // I do not know vue, it is for react, but you can got the idea.
<th className={column.columnDef.meta?.className ?? ""}> // also for <td> Hope it is useful. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
richcoleman-alphatrust
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add a property for the class name into column
meta
.Then, you can define a className for the column that you want:
Then, you can get it through the
column.columnDef.meta?.className
.Hope it is useful.