6.7.6
Can not align component within the cell.
Check this out: https://codesandbox.io/s/ojyx80ljo5
I've added the property className and defined the CSS class in index.css.
index.js:
{
Header: "Last Name",
id: "lastName",
accessor: d => d.lastName,
className: "right"
}
index.css:
.right {
text-align: right;
}
If you want the Column name to be aligned right
Header: () => (
<div style={{
textAlign: "right"
}}>
Actions
</div>
)
@DamianFekete @parwat08 both your solutions align the text in the table header,
i'd bet @M1chaelChen was referring to aligning the values, and that's done diffrently:
@robertvasile, my proposal works OK. Check the green values/cells: https://codesandbox.io/s/ryj15q8wyq , they are right-aligned.
@parwat08 already said that her/his change it is for the column name, not the values. That may be useful if you want to align everything, not only values.
@DamianFekete Thanks mate
@robertvasile Mine solution might be useful if someone wants to align the column name. I already have mentioned it.
I found this very helpful to align the components within all the cells in the table:
getTdProps={() => ({
style: {
textAlign: 'right'
}
})}
Most helpful comment
Check this out: https://codesandbox.io/s/ojyx80ljo5
I've added the property
classNameand defined the CSS class in index.css.index.js:index.css: