Headers alignment #93
-
|
Is there a simple way to align headers? (e.g to center or to the right) A simple way could be using the "Header" prop on the columns array: However this doesn't work! I noticed this is because the header is being a child of a non-accessible parent element which unfortunately has no width. Changing the A solution for the above code to work could be: As a workaround I used a ref hook and side effect hook to find the non-accessible parent and change its width. The Header prop has to be updated with the ref too: Please, let me know if I missed something that could be used to make this header alignment! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Yes, actually and it is way simpler than all that by using the I hadn't added it to the docs yet, but you can see some storybook stories showing the default behavior https://www.material-react-table.dev/?path=/story/styling-table-alignment-examples--center-all-cells |
Beta Was this translation helpful? Give feedback.
Yes, actually and it is way simpler than all that by using the
alignprop inmuiTableHeadCellPropsI hadn't added it to the docs yet, but you can see some storybook stories showing the default behavior
https://www.material-react-table.dev/?path=/story/styling-table-alignment-examples--center-all-cells