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

responsive container infers the parent div height [low priority] #4519

Open
MiguelG97 opened this issue May 11, 2024 · 1 comment
Open

responsive container infers the parent div height [low priority] #4519

MiguelG97 opened this issue May 11, 2024 · 1 comment

Comments

@MiguelG97
Copy link

MiguelG97 commented May 11, 2024

[Just posting it as it's something I struggled with but everything is working fine when setting fixed height values]

It would be comfortable to set the div parent of a responsive container to take the remaining space of another div parent element:

Example: here I'm using the flex-1 short cut from tailwind to take the remaining space from the parent div. Apparently with this setup, the chart does not show up.

      <div
        className="flex flex-row justify-between items-center
        flex-1 w-full"
      >
<ResponsiveContainer>...</ResponsiveContainer>
</div>

image

Instead I needed to explicitly type the height class name as h-[230px] in the nearest div parent to show up the chart

      <div
        className="flex flex-row justify-between items-center
        h-[230px] w-full"
      >
        <ResponsiveContainer
        >
         ...
        </ResponsiveContainer>
      </div>

image

"recharts": "^2.12.6",

[Just posting it as it's something I struggled with but everything is working fine when setting fixed height values]

@MiguelG97 MiguelG97 changed the title responsive container infers the parent div height responsive container infers the parent div height [low priority] May 11, 2024
@ckifer
Copy link
Member

ckifer commented May 12, 2024

Hi! It's documented that the responsive container requires one of width or height to be a static value (usually height). Understood that this isn't always ideal but I don't think there's a way to make things happy otherwise. If you have any ideas feel free to mention them here or contribute!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants