Scaffold is a layout component that provides a base structure for your application with support for AppBar, side Sidebars (start/end), and BottomBar.
This is the main scrollable content.
Prop | Type | Default |
|---|---|---|
No dataThere are no records to display | ||
The start and end components have fixed classes by default. Additionally, if
you use AppBar or BottomBar, these also have fixed classes.
To achieve a correct layout, you must use margins in mainClass, startClass, and endClass.
start sidebar with w-48, use ml-48 in mainClassend sidebar with w-56, use mr-56 in mainClassAppBar with h-16, use mt-16 in mainClass, startClass, and endClassThe vh-* utilities calculate the viewport height
by subtracting the specified value:
vh-16: Calculates calc(100vh - 4rem) - Ideal when there's
only an AppBar with h-16vh-32: Calculates calc(100vh - 8rem) - Ideal when there's
both AppBar and BottomBar, each with h-16These utilities are applied to mainClass, startClass, and endClass so that components have the correct
height without causing scroll on the main page.
<Scaffold
mainClass="lg:ml-48 xl:mr-56 vh-16 mt-16"
startClass="vh-16 mt-16"
endClass="vh-16 mt-16"
>
{#snippet appBar()}
<AppBar class="h-16">
<!-- AppBar content -->
</AppBar>
{/snippet}
{#snippet start()}
<Sidebar class="w-48">
<!-- Start sidebar content -->
</Sidebar>
{/snippet}
<!-- Main content -->
<div>Content</div>
{#snippet end()}
<div class="w-56">
<!-- End sidebar content -->
</div>
{/snippet}
</Scaffold>In this example:
vh-16 is used because there's
an AppBar with h-16mt-16 creates space for the fixed
AppBarml-48 creates space for the start
sidebarmr-56 creates space for the end
sidebar💡 Tip: If you have both AppBar and BottomBar, each with h-16, you should use vh-32 instead of vh-16 to add both heights (16 + 16
= 32).
vh-8 calc(100vh - 2rem)
vh-10 calc(100vh - 2.5rem)
vh-12 calc(100vh - 3rem)
vh-14 calc(100vh - 3.5rem)
vh-16 calc(100vh - 4rem)
vh-20 calc(100vh - 5rem)
vh-24 calc(100vh - 6rem)
vh-32 calc(100vh - 8rem)
vh-40 calc(100vh - 10rem)