Skip to content

cellClassName & headerClassname v8 #4100

Answered by jordanjustice
laurent512 asked this question in Q&A
Discussion options

You must be logged in to vote

@laurent512 I was struggling to find the same thing for a few days, but stumbled across this question: #4097

With the clue there, I'm now defining a cellClassName and headerClassName in the column def's meta object.

const defaultColumns: ColumnDef<Submission>[] = [
  {
    id: 'actions',
    header: '',
    size: 20,
    minSize: 20,
    maxSize: 20,
    enableResizing: false,
    meta: {
      cellClassName: 'w-4'
    },
    cell: () => <div className="w-5 h-5 bg-red-600 rounded-full" />
  }
]

...
// The `td` element in the table now has this for grabbing the classes (note the optional chaining)
<td
  key={cell.id}
  className={classNames(
    'px-4 py-2.5 text-sm font-sans text-blue-gr…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@marceloverdijk
Comment options

Answer selected by laurent512
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants