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
| Name | Type | Description |
|---|---|---|
src? | string | null | App banner image ( |
icon? | string | null | App icon ( |
title? | string | null | The app title, the page's one |
description? | string | null | One line under the title (two on a phone); behind an info button when |
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 |
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
| Name | Type | Description |
|---|---|---|
current | AppIdentity | 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
| Name | Type | Description |
|---|---|---|
icon | string | Icon name rendered in the workspace hero (for example |
title | string | Page title rendered in the workspace hero and the document head. |
description | string | 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 |
|
actions? | Snippet | Header actions the shell places beside the hero title. |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
size? | BoundSize |
|
min_height? | string | A |
height? | string | An explicit height (a CSS length, e.g. |
pad? | LayoutPad | Padding on every side (default |
inset? | boolean | Pad with the app inset, unless an enclosing region already owns it. |
clip? | boolean | Clip content that overflows the box. |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
measure? | CenterMeasure | The maximum width: |
layout? | CenterLayout | Arrange direct children while keeping centring and composition on the same element. |
gap? | LayoutGap | Space between children (default |
align? | 'start' | 'center' | 'end' | 'baseline' | 'stretch' | Cross-axis placement of children; |
justify? | 'start' | 'center' | 'end' | 'between' | Main-axis placement of children (default |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
gap? | LayoutGap | Space between items, across and between lines (default |
align? | 'start' | 'center' | 'end' | 'baseline' | Vertical placement of items within a line (default |
justify? | 'start' | 'center' | 'end' | 'between' | Horizontal placement of items within a line (default |
size? | LayoutSize |
|
min_height? | string | A |
divided? | boolean | A hairline between children — a segmented strip. Pair with |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
span? | ColumnSpan | Columns spanned (default 1); in a |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
count? | ColumnCount | Columns per row (default 2). |
gap? | LayoutGap | Space between cells (default |
collapse? | 'compact' | 'narrow' | 'none' | Below this width of the Columns itself, every child takes a full row. |
children | Snippet | The cells; wrap one in |
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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
gap? | LayoutGap | Space between |
pad? | LayoutPad | Padding on every side (default |
size? | LayoutSize |
|
min_height? | string | A |
center? | boolean | Centre the body's content in the space between |
top? | Snippet | Chrome pinned above the body (a header), stacked over it. |
bottom? | Snippet | Chrome pinned below the body (a footer bar). |
children | Snippet | The body: the height between |
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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
ratio? | FrameRatio | The crop: |
children | Snippet | The media, centred; a direct |
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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
gap? | LayoutGap | Space between cells (default |
row_gap? | LayoutGap | Space between rows when it differs from |
align? | 'start' | 'center' | 'end' | 'stretch' | Block-axis placement of every cell. |
minimum? | GridMinimum | Smallest cell width before wrapping: |
tracks? | string | Explicit column tracks. When set, this is the grid template (via |
children | Snippet | The cells; wrap one in |
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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
placement? | ImposterPlacement | Where the layer sits over its positioned ( |
offset? | ImposterOffset | Distance from the edges it is pinned to: |
layer? | ImposterLayer | The stacking layer. |
position? | 'absolute' | 'fixed' | 'sticky' |
|
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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
gap? | LayoutGap | Space between children (default |
align? | 'start' | 'center' | 'end' | 'baseline' | 'stretch' | Vertical placement of children (default |
justify? | 'start' | 'center' | 'end' | 'between' | Horizontal placement of children (default |
size? | LayoutSize |
|
min_height? | string | A |
divided? | boolean | A hairline between children — a segmented strip. Pair with |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
axis? | ScrollAxis | The scrolling axis: |
name | string | 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 |
align? | 'start' | 'center' | 'end' | 'baseline' | 'stretch' | Cross-axis placement of children; |
justify? | 'start' | 'center' | 'end' | 'between' | Main-axis placement of children (default |
size? | LayoutSize |
|
min_height? | string | A |
snap? | boolean | Snap children to the start edge along the scroll axis — a reel of lanes or cards. |
max? | 'compact' | 'standard' | 'tall' | A |
ref? | HTMLElement | null | The rendered element, for measurement or focus. |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
ratio? | SplitRatio | Width of |
collapse? | SplitCollapse | Below |
collapse_at? | 'compact' | 'narrow' | The Split's own width to collapse below: |
gap? | LayoutGap | Space between the panes (default |
size? | LayoutSize |
|
min_height? | string | A |
start | Snippet | The first pane (left, or top when stacked). |
end | Snippet | The second pane. |
switch_labels? | readonly [string, string] | Tab labels for |
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
| Name | Type | Description |
|---|---|---|
as? | LayoutElement | The element rendered; |
gap? | LayoutGap | Space between children (default |
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? | LayoutSize |
|
min_height? | string | A |
divided? | boolean | A hairline between children — a list of rows. Pair with |
reverse? | boolean | Last child on top: a log read newest-first without reversing the data. |
children | Snippet | 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
| Name | Type | Description |
|---|---|---|
children? | import('svelte').Snippet | Inner surface content. |
tone? | SurfaceTone | Semantic surface fill (default |
padding? | SurfacePadding | Inner padding scale (default |
radius? | SurfaceRadius | Corner geometry token (default |
bordered? | boolean | Hairline semantic border (default |
interactive? | boolean | Subtle hover highlight for clickable/interactive surfaces (default |
as? | 'div' | 'section' | 'article' | 'aside' | 'li' | 'header' | 'footer' | Underlying HTML element (default |
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
| Name | Type | Description |
|---|---|---|
children? | import('svelte').Snippet | Inner surface content. |
tone? | SurfaceTone | Semantic surface fill (default |
padding? | SurfacePadding | Inner padding scale (default |
radius? | SurfaceRadius | Corner geometry token (default |
bordered? | boolean | Hairline semantic border (default |
interactive? | boolean | Subtle hover highlight for clickable/interactive surfaces (default |
as? | 'div' | 'section' | 'article' | 'aside' | 'li' | 'header' | 'footer' | Underlying HTML element (default |
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
| Name | Type | Description |
|---|---|---|
slot | AppIdentitySlot |
|