Skip to content
Advertisement

Table inside Card.Body overflows in react-bootstrap

I am trying to create responsive table with space for a row details section inside a card using react bootstrap.

I have coloured the different sections in different colours so it is easier to see what is going on. For some reason the card body overflows the card by a little. If I remove the Card.Body height it becomes even worse as it starts scrolling the page as well.

EDIT: Here is the sandbox: https://codesandbox.io/s/kind-allen-qn90pz?file=/src/App.tsx

Here is a simplified version of my code:

JavaScript

This gets mounted by react in the index.html which looks like this:

JavaScript

And here is the result it produces: The result

Any ideas how to fix this?

Advertisement

Answer

The solution posted by @irous was close but never did work quite right for me because of the 80% max height on the card body.

After a few days of trial and error I finally found this StackOverflow answer. Based on the explanation in it as well as @irous’s answer I figured I just need to add a style={{minHeight: 0}} on the Card.Body.

This is what the modified code from the OP looks like:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement