Skip to content

templates layout

GitHub Actions edited this page Sep 17, 2026 · 1 revision

templates/layout

Import: import { asRapidLayout, createLayoutTemplate } from "@tundralibs/ui/templates/layout"

Functions

asRapidLayout

asRapidLayout(frame: (body: Html, data: LayoutData) => Html): RapidTemplate

Turn any layout into the RapidTemplate<{ body, title? }> that Application.initialize({ ui: { layout } }) expects. The frame (nav, sidebar, footer) is fixed at initialize time — it is not per-request data — so it is a closure, and only body flows through:

ui: { layout: asRapidLayout((body) => SidebarLayout({ header, sidebar, sidebarId, content: body })) }

createLayoutTemplate

createLayoutTemplate(config = : LayoutConfig): RapidTemplate

Convenience: a Navbar (+ optional Sidebar) frame from plain config — StackedLayout without sidebarItems, SidebarLayout with them.

Types

LayoutData

Prop Type Required Description
body Html yes
title string

LayoutConfig

Prop Type Required Description
brand Html
navLinks NavbarLink[]
navActions Html
sidebarItems MenuItem[]

Clone this wiki locally