Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow text alignment inside TableCell #855

Open
tvanantwerp opened this issue May 26, 2023 · 1 comment
Open

Allow text alignment inside TableCell #855

tvanantwerp opened this issue May 26, 2023 · 1 comment
Labels
feature-request "Wouldn't it be cool if I could...?" ui-extensions

Comments

@tvanantwerp
Copy link

Is your feature request related to a problem? Please describe.

It's common for a column of a table to contain currency amount, and for those amounts to be right-aligned to allow for easy visual skimming.

However, the TableCell takes no CSS and does not allow for text alignment.

Describe the solution you'd like
The ability to right-align the contents of a TableCell. This could be a css property on TableCell itself, or at least correct rendering of Boxes inside TableCells such that they can fill the cell and have alignment.

Describe alternatives you've considered

Inserting other components like Box inside the cells doesn't help—the Boxes do not fill the full width of the TableCell despite css={{ width: 'fill' }}, nor can they be set to css={{ alignSelfX: 'end' }} with any success. The use of Box inside TableCell created two nests <div>s, and the outer div is limited in size—the specified CSS only applies to the inner div, which is constrained by its parent and can't adjust.

Additional context
Table that has left-aligned currency values, but which should have right-aligned values:

image

And failure of using Boxes with css props to align the text inside the cell:

image image
@tvanantwerp tvanantwerp added feature-request "Wouldn't it be cool if I could...?" needs-triage labels May 26, 2023
@tvanantwerp tvanantwerp changed the title Allow test alignment inside TableCell Allow text alignment inside TableCell May 26, 2023
@tvanantwerp
Copy link
Author

I've just discovered this is possible by using align in the TableCell or TableHeaderCell. E.g., <TableCell align="right">...</TableCell>. It would be good to have this mentioned in the documentation. The align property in <td> is deprecated, so it's a non-obvious choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request "Wouldn't it be cool if I could...?" ui-extensions
Projects
None yet
Development

No branches or pull requests

3 participants
@tvanantwerp @auchenberg-stripe and others