Box is a full-height, scrollable shell used inside layouts, drawers, and panels. It accepts standard div HTML attributes plus visual toggles.
Setup
<script lang="ts">
import { Box } from '.';
</script> Default
<script lang="ts">
import { Box } from '.';
</script>
<div class="h-40 border border-gray-200">
<Box>
{#each Array(10) as _, i}
<p>Scrollable line {i + 1}</p>
{/each}
</Box>
</div> With padding, radius, and shadow
<script lang="ts">
import { Box } from '.';
</script>
<div class="h-44 border border-gray-200">
<Box padding bgWhite rounded shadow>
<p>Panel content</p>
{#each Array(6) as _, i}
<p>Line {i + 1}</p>
{/each}
</Box>
</div> Extra classes
Pass layout utilities through otherClasses (or native class via rest attributes when needed).
<Box padding rounded bgWhite otherClasses="border border-dashed border-gray-300">
<p>Dashed border via otherClasses.</p>
</Box> Composition
Box only wraps children — nest typography, lists, forms, or tables inside it. Overflow is vertical (overflow-y-auto) with full width/height.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | Snippet | — | Content inside the scroll area |
padding | boolean | false | Apply p-6 |
rounded | boolean | false | Apply rounded-[5px] |
bgWhite | boolean | false | White background |
shadow | boolean | false | Soft gray shadow |
otherClasses | string | '' | Extra class names merged onto the root |
...rest | HTMLAttributes<HTMLDivElement> | — | Passed to the root div |