Expanding component to fit screen/container
Last updated
Last updated
You may have cases when you need your components to take up all the available width and height of the page regardless of the user's screen size, for example, to avoid getting a scroll bar. In such cases, you can use our Expand content to fit feature. Let's explore it in more details.
Let's say you have added a Table to your page and you want it to occupy all the available space. You simply need to select the Expand content to fit checkbox in page settings on the right side panel.
Now, let's say you've also added a Button to the page, for example, and now you want both Table and Button to occupy all available space. If you try selecting the Expand content to fit checkbox now, you'll notice that it's disabled.
This is because the feature is designed to ensure that a single child component can stretch to fully occupy its parent container’s available space.
When multiple child components are present, the layout must accommodate all of them, making it impossible for one element to expand to 100% without conflicting with the others.
In such cases, you need to add a Card component to the page and put your components inside the Card.
First, select the Expand content to fit checkbox in page settings on the right side panel.
Next, drag and drop a Card component into your working area.
Now, select the Expand content to fit checkbox for the Card as well.
Then, drop a Table component to the Card body - it should occupy all available space.
Add other components you need to the Card header, for example, Text input - to add some filters.
Additionally, for the Card, you can also Disable container styles and set a transparent background. The final result will look like your components are not placed inside any additional container.
That's it! Now you get a page that looks excellent on every screen size and is not limited to single component only.