react-daisyui icon indicating copy to clipboard operation
react-daisyui copied to clipboard

Sizing for table columns

Open kaeon opened this issue 1 year ago • 5 comments

How can we set fixed or max sizing for table columns? I read for daisyui you have to do this with min-width and max-width on the table cell td elements (https://github.com/saadeghi/daisyui/discussions/532) but I can't figure out how to control the classnames for td elements with following <Table.Row>

<Table.Row hover > <span>col1</span> <span>col2</span> <span>col3</span> </Table.Row>

kaeon avatar Apr 13 '23 09:04 kaeon

Reading the library's code, the current implementation of Table.Row doesn't allow a className to be provided to the cells specifically. In this case I believe you would achieve what you want by providing the className to the span tags.

dev0T avatar Apr 17 '23 22:04 dev0T

I'm not in love with how Tables are designed at the moment. We could expose a cellClassNames prop, but then different cells would want different styles etc... Any way I can think of to deal with this feels like a hack. Probably best to just tear out the existing logic and make something like a <Table.Cell> component.

benjitrosch avatar Apr 20 '23 13:04 benjitrosch

I'm not in love with how Tables are designed at the moment. We could expose a cellClassNames prop, but then different cells would want different styles etc... Any way I can think of to deal with this feels like a hack. Probably best to just tear out the existing logic and make something like a <Table.Cell> component.

Something like <Table.Cell> seems logical indeed

kaeon avatar Apr 20 '23 14:04 kaeon

Same happening here. Even using tanstack table with react-daisyui, current implementation doesn't allow editing td width.

hjhjdev avatar May 04 '23 08:05 hjhjdev

Does anyone know a workaround for this?

kaeon avatar Jun 17 '23 08:06 kaeon