Skip to content

ui/layout

ui/layout

Import from @norbital-ai/ui/layout

The layout layer: the layoutPack primitives and AppShell. Inset and scroll-port context stay internal.

app-header

AppHeader component

component AppHeader(props: AppHeaderProps)

The app hero above a page: the running app's banner, icon, title and actions (AppShell publishes them). compact is the phone's one top bar: one line holding the shell's own controls (leading, trailing), the title with its description behind an info button, and the page's scope controls behind one button.

Props

NameTypeDescription
src?string | null

App banner image (bolt:banner). Decorative only — copy sits on the dark scrim. Optional: without one the header keeps its base wash and stays legible.

icon?string | null

App icon (bolt:icon). Opaque chip so it stays readable on any banner.

title?string | null

The app title, the page's one h1; truncated to one line.

description?string | null

One line under the title (two on a phone); behind an info button when compact.

actions?Snippet | undefined

Trailing controls for the running app — a scope picker, an export button.

This exists so an app does not have to repeat its own title in a second PageHeader just to hang a control off it. Identity is rendered once, here, and the app contributes only the part the shell cannot know.

compact?boolean

The phone's top bar: one line, the banner behind it, the description behind an info button, the actions in a popover.

actions_label?string

The accessible name of the compact actions button.

leading?Snippet

Shell controls before the identity (the navigation button). Compact only.

trailing?Snippet

Shell controls after the identity (the bell, Norbius). Compact only.

class?string

Classes for the header element.

Source: packages/ui/src/layout/app-header.svelte:1

app-identity

AppIdentitySlot type

type AppIdentitySlot = {
    current: AppIdentity | null;
};

The slot an AppShell writes its translated identity into for the chrome above it.

Members

NameTypeDescription
currentAppIdentity | null

Source: packages/ui/src/layout/app-identity.svelte.ts:24

app-shell

AppShell component

component AppShell(props: AppShellProps)

An app page's shell: the hero (icon, title, description, banner), header actions, and the page body in the shared inset. Every +<page>.page.svelte renders inside one.

Props

NameTypeDescription
iconstring

Icon name rendered in the workspace hero (for example lucide:cpu).

titlestring

Page title rendered in the workspace hero and the document head.

descriptionstring

Page description rendered under the hero title.

banner?string

Banner artwork for the hero background and, unless overridden, the app thumbnail.

thumbnail?string

App card artwork. Defaults to the banner.

variant?AppShellVariant

page (default) wraps content in the shared inset region so it aligns with the hero icon leading edge; full skips the wrapper for tab strips (which carry their own matching inset) and full-bleed surfaces.

actions?Snippet

Header actions the shell places beside the hero title.

childrenSnippet

The page body; it fills the space below the hero.

Example

<AppShell icon="lucide:briefcase" title={ctx.t('jobs.title')} description={ctx.t('jobs.description')}>
<Table {ctx} of="jobs" />
</AppShell>

Source: packages/ui/src/layout/app-shell.svelte:1

bound

Bound component

component Bound(props: BoundProps)

A region with a height contract (content, fill, viewport), optional padding, inset and clipping: the box a scrollport or a view fills.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

size?BoundSize

content (default): its own height — a clip or inset boundary; fill: the space left in its parent, down to min_height; viewport: min(42rem, 100dvh − 14rem) with a 28rem floor, so a view in a page that scrolls claims the space below a ~14rem chrome band.

min_height?string

A fill bound's floor (a CSS length; default 0).

height?string

An explicit height (a CSS length, e.g. 20rem) for a bounded view inside a scroll; implies flex-none.

pad?LayoutPad

Padding on every side (default none); ignored when inset pads.

inset?boolean

Pad with the app inset, unless an enclosing region already owns it.

clip?boolean

Clip content that overflows the box.

childrenSnippet

The bounded content.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/bound.svelte:1

center

Center component

component Center(props: CenterProps)

Centres its content at a reading measure (narrow, reading, wide, full), optionally laying out its children as a stack, row, cluster or grid.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

measure?CenterMeasure

The maximum width: narrow (a card or form), reading (default), wide, full.

layout?CenterLayout

Arrange direct children while keeping centring and composition on the same element.

gap?LayoutGap

Space between children (default none); ignored for layout="block".

align?'start' | 'center' | 'end' | 'baseline' | 'stretch'

Cross-axis placement of children; stretch for a stack or grid, center otherwise.

justify?'start' | 'center' | 'end' | 'between'

Main-axis placement of children (default start); ignored for layout="block".

childrenSnippet

The centred content.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/center.svelte:1

cluster

Cluster component

component Cluster(props: ClusterProps)

A wrapping row of items with a gap: tags, buttons, metadata. Children wrap to the next line when the row is full.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

gap?LayoutGap

Space between items, across and between lines (default sm).

align?'start' | 'center' | 'end' | 'baseline'

Vertical placement of items within a line (default center).

justify?'start' | 'center' | 'end' | 'between'

Horizontal placement of items within a line (default start).

size?LayoutSize

content (default): its own size, never squeezed; fill: the space left in its parent, down to min_height.

min_height?string

A fill box's floor (a CSS length; default 0).

divided?boolean

A hairline between children — a segmented strip. Pair with gap="none".

childrenSnippet

The items.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/cluster.svelte:1

column

Column component

component Column(props: ColumnProps)

One cell of a Grid or Columns spanning span columns (or all); it throws outside those parents.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

span?ColumnSpan

Columns spanned (default 1); in a Grid only 1 or all, in Columns at most its count.

childrenSnippet

The cell's content.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/column.svelte:1

columns

Columns component

component Columns(props: ColumnsProps)

A fixed number of equal columns (1–7) that collapse to one per row below a width of the element itself. Two columns of form fields stay two to a row down to 20rem: a field that needs the row spans it (Field).

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

count?ColumnCount

Columns per row (default 2).

gap?LayoutGap

Space between cells (default md).

collapse?'compact' | 'narrow' | 'none'

Below this width of the Columns itself, every child takes a full row. none keeps the count at any width — only for content that is meaningless stacked (a calendar week).

childrenSnippet

The cells; wrap one in Column to span.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/columns.svelte:1

cover

Cover component

component Cover(props: CoverProps)

A region with optional top and bottom chrome and a body between them, optionally centred: an empty state, a sign-in card, a page with a footer bar. size="fill" takes the space left in its parent, pinning top and bottom and handing the body the height between (a fill child of the body takes it).

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

gap?LayoutGap

Space between top, the body and bottom (default md).

pad?LayoutPad

Padding on every side (default none).

size?LayoutSize

content (default): its own height; fill: the space left in its parent, down to min_height.

min_height?string

A fill cover's floor (a CSS length; default 0).

center?boolean

Centre the body's content in the space between top and bottom — Every Layout's Cover principal: an empty state, a sign-in card, a splash. Without it the body is a scroll owner's slot and starts at the top.

top?Snippet

Chrome pinned above the body (a header), stacked over it.

bottom?Snippet

Chrome pinned below the body (a footer bar).

childrenSnippet

The body: the height between top and bottom, clipped.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/cover.svelte:1

frame

Frame component

component Frame(props: FrameProps)

Crops media to a named aspect ratio (square, portrait, landscape, widescreen, banner). A crop is its own size: never squeezed.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

ratio?FrameRatio

The crop: square 1:1, portrait 3:4, landscape 4:3 (default), widescreen 16:9, banner 2:1.

childrenSnippet

The media, centred; a direct img or video covers the frame.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/frame.svelte:1

grid

Grid component

component Grid(props: GridProps)

An auto-fitting grid of cards at a minimum cell width (compact, card, panel), or explicit column tracks.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

gap?LayoutGap

Space between cells (default md).

row_gap?LayoutGap

Space between rows when it differs from gap (a definition list: wide columns, tight rows).

align?'start' | 'center' | 'end' | 'stretch'

Block-axis placement of every cell.

minimum?GridMinimum

Smallest cell width before wrapping: compact 12rem, card 18rem (default), panel 26rem.

tracks?string

Explicit column tracks. When set, this is the grid template (via style, not a Tailwind class) and minimum is ignored. Use minimum for intrinsic auto-fit cards; use tracks when the columns are a known, uneven measure — a log table, a definition list.

childrenSnippet

The cells; wrap one in Column span="all" to take a whole row.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/grid.svelte:1

layout.shared

INSET_X_CLASS const

const INSET_X_CLASS: "px-4 sm:px-6"

Full-bleed chrome with its own vertical rhythm (PageHeader).

Source: packages/ui/src/layout/layout.shared.ts:157

imposter

Imposter component

component Imposter(props: ImposterProps)

A layer positioned over its relative parent: a scrim, a pinned badge, a bar or a centred dialog body, at a stacking layer.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

placement?ImposterPlacement

Where the layer sits over its positioned (relative) parent. fill covers it (a scrim, a camera guide); top/bottom are full-width bars, start/end full-height strips; the corners pin a badge or control; center-start/center-end centre it on an edge.

offset?ImposterOffset

Distance from the edges it is pinned to: sm (0.5rem) for a corner or an edge-centred control, none for a bar, a strip or fill, which run to the edge by default.

layer?ImposterLayer

The stacking layer. under sits beneath later siblings (a decorative backdrop), raised above them, overlay above page chrome (a drag preview, a table-of-contents panel), modal above everything (a full-screen takeover).

position?'absolute' | 'fixed' | 'sticky'

absolute pins to the parent; fixed to the viewport; sticky stays in flow and sticks to its scrollport's edge — a table header, a rail.

contain?boolean

Keep the layer inside the parent: never larger than it, scrolling if it must.

children?Snippet

Absent for a purely decorative layer (a track line, a hit area).

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/imposter.svelte:1

inline

Inline component

component Inline(props: InlineProps)

A single non-wrapping row of children with a gap and alignment: a toolbar, a label and its value.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

gap?LayoutGap

Space between children (default sm).

align?'start' | 'center' | 'end' | 'baseline' | 'stretch'

Vertical placement of children (default center).

justify?'start' | 'center' | 'end' | 'between'

Horizontal placement of children (default start).

size?LayoutSize

content (default): its own size, never squeezed; fill: the space left in its parent, down to min_height.

min_height?string

A fill box's floor (a CSS length; default 0).

divided?boolean

A hairline between children — a segmented strip. Pair with gap="none".

childrenSnippet

The row's children; they never wrap.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Source: packages/ui/src/layout/inline.svelte:1

layout.shared

SCROLL_AXIS_CLASSES const

const SCROLL_AXIS_CLASSES: Record<ScrollAxis, string>

The scrollport classes, per axis — the one definition of what "this region scrolls" means.

Per-axis overscroll-contain: an x-only reel must not trap the parent's vertical scroll, and the axis that does not scroll is clipped rather than left visible, so a wide child cannot paint outside the region.

Scroll is how a region declares itself a scrollport, and is what almost every caller wants. This token exists for the boxes Scroll cannot be: it fills its parent unconditionally, so a pane bounded by its own max-height (a popover, a collapsible) or by a fixed height (a chip reel) cannot be one — and neither can an element a third-party component or a ProseMirror editor owns. Those honour the same contract by naming it, the way INSET_MX_CLASS lets chrome that cannot pad itself still keep the app inset.

Source: packages/ui/src/layout/layout.shared.ts:124

scroll

Scroll component

component Scroll(props: ScrollProps)

The one scroll owner of a region: scrolls on axis, fades edges with content beyond them, and optionally snaps children. name identifies it (a page restores its position). A vertical scroll owner is size="fill" (the space left in its parent, scrolling inside) or content capped by max (a popover list); a content Scroll without a cap is its content's height and scrolls only on x.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

axis?ScrollAxis

The scrolling axis: y (default), x (a reel; the other axis clips) or both.

namestring

The region's accessible name; also identifies it so a page restores its scroll position.

inset?boolean

Pad with the app inset: the scrollport owns it, taking it over from a provisional panel above.

fade?boolean

Fade the edges that have content beyond them. On by default: it is what tells a reader there is more below now that the scroll bar hides at rest. Turn it off for a region whose own content must stay at full opacity to its edge — a media surface, a chart, anything where a soft edge would read as a rendering fault.

layout?ScrollLayout

Arrange direct children without introducing a second wrapper or scroll owner.

gap?LayoutGap

Space between children (default none); ignored for layout="block".

align?'start' | 'center' | 'end' | 'baseline' | 'stretch'

Cross-axis placement of children; center for inline, stretch otherwise.

justify?'start' | 'center' | 'end' | 'between'

Main-axis placement of children (default start); ignored for layout="block".

size?LayoutSize

content (default): its own height, up to max; fill: the space left in its parent, scrolling inside, down to min_height.

min_height?string

A fill scroll's floor (a CSS length; default 0).

snap?boolean

Snap children to the start edge along the scroll axis — a reel of lanes or cards.

max?'compact' | 'standard' | 'tall'

A content scroll's cap: it grows with its content up to it, then scrolls — a popover list, a disclosure body. Capped by the viewport too.

ref?HTMLElement | null

The rendered element, for measurement or focus.

childrenSnippet

The scrolled content.

Source: packages/ui/src/layout/scroll.svelte:1

split

Split component

component Split(props: SplitProps)

Two panes side by side at a ratio (rail, sidebar, third, half, wide) that stack, or switch with a tab pair, below a width. The Split measures its own width, so one in a narrow cell collapses even on a wide screen.

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

ratio?SplitRatio

Width of start against end: rail 10–14rem, sidebar 14–20rem, third 1:2, half (default), wide 2:1.

collapse?SplitCollapse

Below collapse_at: stack the panes (default), switch between them with a tab pair, or none.

collapse_at?'compact' | 'narrow'

The Split's own width to collapse below: narrow 40rem (default) or compact 30rem.

gap?LayoutGap

Space between the panes (default md).

size?LayoutSize

content (default): its own height; fill: the space left in its parent, handed to both panes (down to min_height).

min_height?string

A fill split's floor (a CSS length; default 0).

startSnippet

The first pane (left, or top when stacked).

endSnippet

The second pane.

switch_labels?readonly [string, string]

Tab labels for start and end when collapse="switch"; "First" and "Second" by default.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Example

<Split ratio="sidebar" collapse="switch" switch_labels={['List', 'Detail']} size="fill">
{#snippet start()}<List />{/snippet}
{#snippet end()}<Detail />{/snippet}
</Split>

Source: packages/ui/src/layout/split.svelte:1

stack

Stack component

component Stack(props: StackProps)

A vertical flow of children with a gap: the default layout of a page body, a form or a card. Like every layout primitive, a box is size="content" (the default: its own size, never squeezed — the nearest scroll owner scrolls when boxes do not fit) or size="fill" (the space left in its parent, shrinking to min_height; a Scroll there scrolls inside). Nothing scrolls sideways unless it is a Scroll axis="x".

Props

NameTypeDescription
as?LayoutElement

The element rendered; div by default.

gap?LayoutGap

Space between children (default md).

align?'start' | 'center' | 'end' | 'stretch'

Cross-axis (horizontal) placement of the children.

justify?'start' | 'center' | 'end' | 'between'

Main-axis (vertical) placement of the children.

Only meaningful when the Stack has more height than its content: size="fill". A Stack whose height comes from its own content has nothing to distribute, which is why placing content against a min-h-* parent silently does nothing and the content stays at the top.

size?LayoutSize

content (default): its own size, never squeezed; fill: the space left in its parent, down to min_height.

min_height?string

A fill box's floor (a CSS length; default 0).

divided?boolean

A hairline between children — a list of rows. Pair with gap="none".

reverse?boolean

Last child on top: a log read newest-first without reversing the data.

childrenSnippet

The stacked children.

ref?HTMLElement | null

The rendered element, for measurement or focus.

Example

<Stack gap="md" size="fill">
<h2>{title}</h2>
<Scroll name="Notes" size="fill">{notes}</Scroll>
</Stack>

Source: packages/ui/src/layout/stack.svelte:1

surface

Surface component

component Surface(props: SurfaceProps)

A semantic surface container (card, subtle, muted, lane, popover, transparent) with standardized hairline border, corner geometry (control 6px, overlay 12px, inset 4px) and spacing — eliminating raw Tailwind border/radius/dark: utility soup in tenant pages.

Props

NameTypeDescription
children?import('svelte').Snippet

Inner surface content.

tone?SurfaceTone

Semantic surface fill (default 'card').

padding?SurfacePadding

Inner padding scale (default 'md').

radius?SurfaceRadius

Corner geometry token (default 'control' — 6px).

bordered?boolean

Hairline semantic border (default true).

interactive?boolean

Subtle hover highlight for clickable/interactive surfaces (default false).

as?'div' | 'section' | 'article' | 'aside' | 'li' | 'header' | 'footer'

Underlying HTML element (default 'div').

Example

<Surface tone="card" padding="md" radius="control">
<Stack gap="sm">...</Stack>
</Surface>

Source: packages/ui/src/layout/surface.svelte:1

SurfacePadding type

type SurfacePadding = 'none' | 'xs' | 'sm' | 'md' | 'lg';

Inner padding scale for Surface.

Source: packages/ui/src/layout/surface.svelte:18

SurfaceProps type

type SurfaceProps = HTMLAttributes<HTMLElement> & {
    /** Semantic surface fill (default `'card'`). */
    tone?: SurfaceTone;
    /** Inner padding scale (default `'md'`). */
    padding?: SurfacePadding;
    /** Corner geometry token (default `'control'` — 6px). */
    radius?: SurfaceRadius;
    /** Hairline semantic border (default `true`). */
    bordered?: boolean;
    /** Subtle hover highlight for clickable/interactive surfaces (default `false`). */
    interactive?: boolean;
    /** Underlying HTML element (default `'div'`). */
    as?: 'div' | 'section' | 'article' | 'aside' | 'li' | 'header' | 'footer';
    /** Inner surface content. */
    children?: Snippet;
};

Props accepted by Surface.

Members

NameTypeDescription
children?import('svelte').Snippet

Inner surface content.

tone?SurfaceTone

Semantic surface fill (default 'card').

padding?SurfacePadding

Inner padding scale (default 'md').

radius?SurfaceRadius

Corner geometry token (default 'control' — 6px).

bordered?boolean

Hairline semantic border (default true).

interactive?boolean

Subtle hover highlight for clickable/interactive surfaces (default false).

as?'div' | 'section' | 'article' | 'aside' | 'li' | 'header' | 'footer'

Underlying HTML element (default 'div').

Source: packages/ui/src/layout/surface.svelte:23

SurfaceRadius type

type SurfaceRadius = 'control' | 'overlay' | 'inset' | 'none';

Corner geometry role for Surface.

Source: packages/ui/src/layout/surface.svelte:20

SurfaceTone type

type SurfaceTone = 'card' | 'subtle' | 'muted' | 'lane' | 'popover' | 'transparent';

Semantic surface fill role.

Source: packages/ui/src/layout/surface.svelte:16

app-identity

set_app_identity_slot function

function set_app_identity_slot(slot: AppIdentitySlot): AppIdentitySlot

Opens the slot for everything rendered beneath the shell.

Parameters

NameTypeDescription
slotAppIdentitySlot
  • current: AppIdentity | null

Source: packages/ui/src/layout/app-identity.svelte.ts:29