Ability to set column width and className
for <th> and <td> in shadcn-ui Data Table
#1122
-
Hi, I am unable to add classNames to and in shadcn-ui Data Table, I used the same method as used on Data Table - shadcn/ui but I am unable to set classNames in the above stated elements |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I want to do something like this
|
Beta Was this translation helpful? Give feedback.
-
I copied and pasted this snippet into VSCode: I think you should be able to target and tweak the header row (to include a All this to say, you're going about this the wrong way. The But you can rewrite the markup completely and use things like Hope this helps. If you make a CodeSandbox or something, I'll be happy to tweak it to work for you. |
Beta Was this translation helpful? Give feedback.
Hi, just found a workaround, added an array of classNames as a prop in data-table.tsx, and took the column index from the map in data-table.tsx, now I just pass the classNames like
["w-32", "w-48", "", "w-12", "w-32", "w-16"]
, works fine for me, thanks for the helpThis discussion can be hence closed now
Thanks everyone for making such a beautiful library :D