Skip to content

Box

Bordered container with separators on all sides.

Location

src/lib/svelte/layout/Box.svelte

Purpose

Wraps content with separator borders on any combination of sides. Used for grouping related UI elements with visual boundaries.

Visual

╭──────────────────────────╮
│                          │
│         content          │
│                          │
╰──────────────────────────╯

Props

NameTypeDefaultDescription
widthnumberrequiredBox width
heightnumberrequiredBox height
showTopbooleantrueShow top separator
showBottombooleantrueShow bottom separator
showLeftbooleantrueShow left separator
showRightbooleantrueShow right separator
thicknessnumber8Separator thickness
cornerRadiusnumber6Gull wing radius
childrenSnippetContent to wrap

State

None — purely presentational.

Styling

  • Uses separators for borders (not CSS borders)
  • Content area fills remaining space

CSS Classes

ClassPurpose
.boxContainer, relative position
.box-contentInner content area, flex: 1

Children

  • Separator components for each visible edge
  • User-provided content via children snippet

Simplifications from webseriously

  • Removed: absolute positioning (top, left, zindex)
  • Removed: name prop for class naming
  • Uses snippets instead of slots
  • Simplified structure — no nested wrapper divs