Data table font sizes too big

Sorry dumb polaris question here - why are the font sizes so big in the data table as compared to the docs: https://clhom.gadget.app/edit/development/files/web/routes/index.jsx
No description
No description
9 Replies
kalenjordan
kalenjordanOP5mo ago
@Millan any word here? Seems like it's defaulting to bodyLg somehow - I can't seem to figure out why.
Millan
Millan5mo ago
May I make a fork of your app to do some experimenting?
kalenjordan
kalenjordanOP5mo ago
sure thanks!
Millan
Millan5mo ago
The index.jsx file that you have in your app right now looks like it is getting styles from the custom column configs in the route preview area, and I've observed the same in a test app that I made to simulate yours. Did you observe those font styles getting overwritten in the Shopify admin ?
No description
kalenjordan
kalenjordanOP5mo ago
yeah I put those custom column configs in myself as a way to get the font sizes the way I wanted them to be - but I'm trying to better understand the root cause now and clean this up - shouldn't need those custom column configs for the text to render as bodyMd by default right?
Millan
Millan5mo ago
Behind the scenes. AutoTable does not use the Polaris Text component for the table cell values because Polaris components do not have ref props, which we use to determine if the text is overflowing so that we can provide a tooltip. We use a span that has these css classes on them
Polaris-Text--root
Polaris-Text--block
Polaris-Text--truncate
Polaris-Text--root
Polaris-Text--block
Polaris-Text--truncate
You could perhaps target those css classes within AutoTable as a way to avoid the custom column configs
kalenjordan
kalenjordanOP5mo ago
ah gotcha but I'm also using a DataTable and it has the same issue? The promotions table up top is just a DataTable
Millan
Millan5mo ago
DataTable from Polaris takes in rows as a prop which is a collection of react components that you are defining. I see that you are using Text from Polaris there, and if it is not getting the styles you expect, I would honestly consider implementing my own text component as Polaris does not have much support for style overrides
kalenjordan
kalenjordanOP5mo ago
k

Did you find this page helpful?