Replies: 1 comment
|
Yes—CSS Grid can give the two items different heights within the same row. Give the row the available height, keep items aligned to the top, and override the left item to stretch. With Mantine import { Box } from '@mantine/core';
export function Panels() {
return (
<Box
h="100vh"
style={{
display: 'grid',
gridTemplateColumns: '30% minmax(0, 1fr)',
gridTemplateRows: 'minmax(0, 1fr)',
alignItems: 'start',
}}
>
<Box bg="blue" style={{ alignSelf: 'stretch', minHeight: 0 }}>
1
</Box>
<Box bg="red" style={{ minWidth: 0 }}>
2
</Box>
</Box>
);
}The row fills the container’s definite This keeps your original overflow behavior: if the right content is taller than the viewport, it overflows. If you want an independently scrolling right panel, add References: Mantine Box and CSS Grid item sizing/alignment. |
Uh oh!
There was an error while loading. Please reload this page.
Hi, can a grid be used to do something like this?:
ie, I need the left (blue) div to be 100% height, while the right (red) div is just the height of its content, but fills the remaining width. Obviously I can get it working with flexbox, but my full use-case is a little more complicated and if I can get it working for grid it would be nice. Or is grid just not intended for situations like this.
Thanks!
All reactions