question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow tables to fit to data width, not 100% of container

See original GitHub issue

What problem does this feature solve?

At the moment, all Ant Design tables are 100% width; when the data is sparse, this makes them very spaced out, and it’s difficult to follow one row to see all the information. I’d like to add an option to the table to fit the data, not the container.

What does the proposed API look like?

A new property on the Table would probably work, something like width={data|full}, with full being the default.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

40reactions
paramsinghvccommented, Jul 1, 2021

Whats the solution for this. Ant Table is so annoying.

8reactions
ibarapascalcommented, Aug 1, 2022

This could do the trick for you

tableLayout='auto'

ref: https://ant.design/components/table/#Table

perhaps with

scroll={{ x: 'max-content' }}

ref: https://ant.design/components/table/#scroll

Read more comments on GitHub >

github_iconTop Results From Across the Web

Force HTML Tables To Not Exceed Their Containers' Size
I have a "dynamic" (percentage based) layout with two columns. .grid { width: 100%; box-sizing: border-box; } .grid > * { box-sizing: border-box...
Read more >
table-layout - CSS: Cascading Style Sheets - MDN Web Docs
This example uses a fixed table layout, combined with the width property, to restrict the table's width. The text-overflow property is used to ......
Read more >
How To Create a Full Width Table - W3Schools
Learn how to create a full-width table with CSS. A table that does not have a set width: Firstname, Lastname, Age. Jill, Smith,...
Read more >
Flexible table width - DataTables example
This example shows a table with width="80%" and the container is also flexible width, so as the window is resized, the table will...
Read more >
How to set fixed width for <td> in a table ? - GeeksforGeeks
By assigning a numeric value to this attribute between 0 to 100 in terms of percentage(or you can use pixel format). We can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found