App Shell
The frame of a signed-in app with a first screen: a sidebar, a top bar, or three panes.
Install
npx ui8kit add app-shellPulls in: activity-feed, app-main, block, chart-panel, compose, container, dashboard-overview, grid, kit-box, kit-text, list, list-item, metric-row, nav-bar, panel, sidebar-nav, stack, text, utils
Preview
Overview
Revenue
$48,200
+8% this month
Orders
1,284
+3% this month
Visitors
92,410
+12% this month
Churn
1.9%
-0.2% this month
Orders this week
Orders per day over the last seven days.
Recent activity
What happened in your workspace.
Plan upgraded to Team
2 min ago
Billing changed by Dana Pierce.
New member joined
1 h ago
Ravi Menon accepted the invitation.
Export finished
Yesterday
Customers.csv is ready to download.
Payment failed
2 days ago
The card ending 4242 was declined.
Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add app-shell<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a
bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar
is a port contract.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { AppNav, AppUser } from "./app-shell.types";
import type { NavLink, NavSearch } from "./nav-bar.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
export type AppShellProps = {
id: string;
title: string;
nav: AppNav;
user: AppUser;
search: NavSearch;
metrics: Metric[];
chart: OverviewChart;
activity: OverviewActivity;
layout?: "sidebar" | "top" | "panes";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Container from "../compose/Container.svelte";
import Grid from "../compose/Grid.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import AppMain from "../components/app-main.svelte";
import NavBar from "../blocks/nav-bar.svelte";
import Panel from "../components/panel.svelte";
import SidebarNav from "../blocks/sidebar-nav.svelte";
import { cn, tpl } from "../utils";
let {
id,
title,
nav,
user,
search,
metrics,
chart,
activity,
layout = "sidebar",
density = "default",
landmarkLabel,
}: AppShellProps = $props();
</script>
<Block
tag="section"
class="bg-background"
aria-labelledby={(landmarkLabel ? undefined : tpl("{0}-title", id))}
data-layout={layout}
aria-label={landmarkLabel}
data-slot="app-shell"
>
{#if ((layout as string) === "top")}
<Stack gap="6" align="stretch">
<NavBar
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
search={search}
actions={{ mode: "none" }}
layout="search"
landmarkLabel={landmarkLabel}
/>
<Container class={cn("mx-auto w-full max-w-6xl px-4", "pb-8")} data-slot="container">
<AppMain id={id} title={title} metrics={metrics} chart={chart} cols="1-4" activity={activity} density={density} />
</Container>
</Stack>
{:else}
<Container class={cn("mx-auto w-full max-w-6xl px-4", "py-8")} data-slot="container">
{#if ((layout as string) === "sidebar")}
<Grid cols="1" class="items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]">
<SidebarNav
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
userName={user.name}
userEmail={user.email}
density={density}
landmarkLabel={landmarkLabel}
/>
<AppMain id={id} title={title} metrics={metrics} chart={chart} activity={activity} density={density} />
</Grid>
{:else}
<Grid cols="1-3" class="items-start gap-4">
<SidebarNav
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
userName={user.name}
userEmail={user.email}
width="compact"
density={density}
landmarkLabel={landmarkLabel}
/>
{#if ((activity.events?.length ?? 0) > 0)}
<Panel title={activity.title} description={activity.text} id={tpl("{0}-list", id)}>
<List class="m-0 flex list-none flex-col gap-4 p-0" data-slot="items">
{#each activity.events as e (e.id)}
<ListItem class="flex flex-col gap-2" data-slot="item">
<Text size="sm" weight="semibold">
{e.title}
</Text>
<Text size="xs" class="text-muted-foreground">
{e.time}
</Text>
</ListItem>
{/each}
</List>
</Panel>
{/if}
<AppMain id={id} title={title} metrics={metrics} chart={chart} density="compact" />
</Grid>
{/if}
</Container>
{/if}
</Block>
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
import type { NavLink } from "./nav-bar.types";
export type AppNav = {
/** accessible name of the navigation */
label: string;
brand: string;
links: NavLink[];
/** id of the current link */
current?: string;
};
export type AppUser = {
name: string;
email: string;
};
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdnnpx ui8kit add app-shell// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a
* bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar
* is a port contract.
*/
import { type ReactNode } from "react";
import { Block, Container, Grid, List, ListItem, Stack, Text } from "../compose";
import { AppMain } from "../components/app-main";
import { NavBar } from "../blocks/nav-bar";
import { Panel } from "../components/panel";
import { SidebarNav } from "../blocks/sidebar-nav";
import { cn, tpl } from "../utils";
import type { AppNav, AppUser } from "./app-shell.types";
import type { NavLink, NavSearch } from "./nav-bar.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
export type AppShellProps = {
id: string;
title: string;
nav: AppNav;
user: AppUser;
search: NavSearch;
metrics: Metric[];
chart: OverviewChart;
activity: OverviewActivity;
layout?: "sidebar" | "top" | "panes";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function AppShell({
id,
title,
nav,
user,
search,
metrics,
chart,
activity,
layout = "sidebar",
density = "default",
landmarkLabel,
}: AppShellProps) {
return (
<Block
tag="section"
className="bg-background"
aria-labelledby={(landmarkLabel ? undefined : tpl("{0}-title", id))}
data-layout={layout}
aria-label={landmarkLabel}
data-slot="app-shell"
>
{((layout as string) === "top") ? (
<Stack gap="6" align="stretch">
<NavBar
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
search={search}
actions={{ mode: "none" }}
layout="search"
landmarkLabel={landmarkLabel}
/>
<Container className={cn("mx-auto w-full max-w-6xl px-4", "pb-8")} data-slot="container">
<AppMain id={id} title={title} metrics={metrics} chart={chart} cols="1-4" activity={activity} density={density} />
</Container>
</Stack>
) : (
<Container className={cn("mx-auto w-full max-w-6xl px-4", "py-8")} data-slot="container">
{((layout as string) === "sidebar") ? (
<Grid cols="1" className="items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]">
<SidebarNav
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
userName={user.name}
userEmail={user.email}
density={density}
landmarkLabel={landmarkLabel}
/>
<AppMain id={id} title={title} metrics={metrics} chart={chart} activity={activity} density={density} />
</Grid>
) : (
<Grid cols="1-3" className="items-start gap-4">
<SidebarNav
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
userName={user.name}
userEmail={user.email}
width="compact"
density={density}
landmarkLabel={landmarkLabel}
/>
{((activity.events?.length ?? 0) > 0) ? (
<Panel title={activity.title} description={activity.text} id={tpl("{0}-list", id)}>
<List className="m-0 flex list-none flex-col gap-4 p-0" data-slot="items">
{(activity.events ?? []).map((e) => (
<ListItem key={e.id} className="flex flex-col gap-2" data-slot="item">
<Text size="sm" weight="semibold">
{e.title}
</Text>
<Text size="xs" className="text-muted-foreground">
{e.time}
</Text>
</ListItem>
))}
</List>
</Panel>
) : null}
<AppMain id={id} title={title} metrics={metrics} chart={chart} density="compact" />
</Grid>
)}
</Container>
)}
</Block>
);
}
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
import type { NavLink } from "./nav-bar.types";
export type AppNav = {
/** accessible name of the navigation */
label: string;
brand: string;
links: NavLink[];
/** id of the current link */
current?: string;
};
export type AppUser = {
name: string;
email: string;
};
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdnnpx ui8kit add app-shell// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
import type { NavLink } from "./nav-bar.types";
export type AppNav = {
/** accessible name of the navigation */
label: string;
brand: string;
links: NavLink[];
/** id of the current link */
current?: string;
};
export type AppUser = {
name: string;
email: string;
};
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a
bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar
is a port contract.
-->
<script lang="ts">
import type { AppNav, AppUser } from "./app-shell.types";
import type { NavLink, NavSearch } from "./nav-bar.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
export type AppShellProps = {
id: string;
title: string;
nav: AppNav;
user: AppUser;
search: NavSearch;
metrics: Metric[];
chart: OverviewChart;
activity: OverviewActivity;
layout?: "sidebar" | "top" | "panes";
density?: "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Block from "../compose/Block.vue";
import Container from "../compose/Container.vue";
import Grid from "../compose/Grid.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import AppMain from "../components/app-main.vue";
import NavBar from "../blocks/nav-bar.vue";
import Panel from "../components/panel.vue";
import SidebarNav from "../blocks/sidebar-nav.vue";
import { cn, tpl } from "../utils";
const {
id,
title,
nav,
user,
search,
metrics,
chart,
activity,
layout = "sidebar",
density = "default",
landmarkLabel,
} = defineProps<AppShellProps>();
</script>
<template>
<Block
tag="section"
class="bg-background"
:aria-labelledby="(landmarkLabel ? undefined : tpl('{0}-title', id))"
:data-layout="layout"
:aria-label="landmarkLabel"
data-slot="app-shell"
>
<Stack v-if="((layout as string) === 'top')" gap="6" align="stretch">
<NavBar
:label="nav.label"
:brand="nav.brand"
:links="nav.links"
:current="nav.current"
:search="search"
:actions="{ mode: 'none' }"
layout="search"
:landmarkLabel="landmarkLabel"
/>
<Container :class="cn('mx-auto w-full max-w-6xl px-4', 'pb-8')" data-slot="container">
<AppMain
:id="id"
:title="title"
:metrics="metrics"
:chart="chart"
cols="1-4"
:activity="activity"
:density="density"
/>
</Container>
</Stack>
<Container v-else :class="cn('mx-auto w-full max-w-6xl px-4', 'py-8')" data-slot="container">
<Grid
v-if="((layout as string) === 'sidebar')"
cols="1"
class="items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]"
>
<SidebarNav
:label="nav.label"
:brand="nav.brand"
:links="nav.links"
:current="nav.current"
:userName="user.name"
:userEmail="user.email"
:density="density"
:landmarkLabel="landmarkLabel"
/>
<AppMain :id="id" :title="title" :metrics="metrics" :chart="chart" :activity="activity" :density="density" />
</Grid>
<Grid v-else cols="1-3" class="items-start gap-4">
<SidebarNav
:label="nav.label"
:brand="nav.brand"
:links="nav.links"
:current="nav.current"
:userName="user.name"
:userEmail="user.email"
width="compact"
:density="density"
:landmarkLabel="landmarkLabel"
/>
<Panel
v-if="((activity.events?.length ?? 0) > 0)"
:title="activity.title"
:description="activity.text"
:id="tpl('{0}-list', id)"
>
<List class="m-0 flex list-none flex-col gap-4 p-0" data-slot="items">
<ListItem v-for="e in activity.events" :key="e.id" class="flex flex-col gap-2" data-slot="item">
<Text size="sm" weight="semibold">
{{ e.title }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ e.time }}
</Text>
</ListItem>
</List>
</Panel>
<AppMain :id="id" :title="title" :metrics="metrics" :chart="chart" density="compact" />
</Grid>
</Container>
</Block>
</template>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdnnpx ui8kit add app-shell// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a
* bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar
* is a port contract.
*/
import { For, type JSX } from "solid-js";
import { Block, Container, Grid, List, ListItem, Stack, Text } from "../compose";
import { AppMain } from "../components/app-main";
import { NavBar } from "../blocks/nav-bar";
import { Panel } from "../components/panel";
import { SidebarNav } from "../blocks/sidebar-nav";
import { cn, tpl } from "../utils";
import type { AppNav, AppUser } from "./app-shell.types";
import type { NavLink, NavSearch } from "./nav-bar.types";
import type { Metric } from "./metric-row.types";
import type { Point } from "./chart-panel.types";
import type { Event } from "./activity-feed.types";
import type { OverviewChart, OverviewActivity } from "./dashboard-overview.types";
export type AppShellProps = {
id: string;
title: string;
nav: AppNav;
user: AppUser;
search: NavSearch;
metrics: Metric[];
chart: OverviewChart;
activity: OverviewActivity;
layout?: "sidebar" | "top" | "panes";
density?: "default" | "compact";
landmarkLabel?: string;
};
export function AppShell({
id,
title,
nav,
user,
search,
metrics,
chart,
activity,
layout = "sidebar",
density = "default",
landmarkLabel,
}: AppShellProps) {
return (
<Block
tag="section"
class="bg-background"
aria-labelledby={(landmarkLabel ? undefined : tpl("{0}-title", id))}
data-layout={layout}
aria-label={landmarkLabel}
data-slot="app-shell"
>
{((layout as string) === "top") ? (
<Stack gap="6" align="stretch">
<NavBar
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
search={search}
actions={{ mode: "none" }}
layout="search"
landmarkLabel={landmarkLabel}
/>
<Container class={cn("mx-auto w-full max-w-6xl px-4", "pb-8")} data-slot="container">
<AppMain id={id} title={title} metrics={metrics} chart={chart} cols="1-4" activity={activity} density={density} />
</Container>
</Stack>
) : (
<Container class={cn("mx-auto w-full max-w-6xl px-4", "py-8")} data-slot="container">
{((layout as string) === "sidebar") ? (
<Grid cols="1" class="items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]">
<SidebarNav
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
userName={user.name}
userEmail={user.email}
density={density}
landmarkLabel={landmarkLabel}
/>
<AppMain id={id} title={title} metrics={metrics} chart={chart} activity={activity} density={density} />
</Grid>
) : (
<Grid cols="1-3" class="items-start gap-4">
<SidebarNav
label={nav.label}
brand={nav.brand}
links={nav.links}
current={nav.current}
userName={user.name}
userEmail={user.email}
width="compact"
density={density}
landmarkLabel={landmarkLabel}
/>
{((activity.events?.length ?? 0) > 0) ? (
<Panel title={activity.title} description={activity.text} id={tpl("{0}-list", id)}>
<List class="m-0 flex list-none flex-col gap-4 p-0" data-slot="items">
<For each={activity.events ?? []}>{(e) => (
<ListItem class="flex flex-col gap-2" data-slot="item">
<Text size="sm" weight="semibold">
{e.title}
</Text>
<Text size="xs" class="text-muted-foreground">
{e.time}
</Text>
</ListItem>
)}</For>
</List>
</Panel>
) : null}
<AppMain id={id} title={title} metrics={metrics} chart={chart} density="compact" />
</Grid>
)}
</Container>
)}
</Block>
);
}
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
import type { NavLink } from "./nav-bar.types";
export type AppNav = {
/** accessible name of the navigation */
label: string;
brand: string;
links: NavLink[];
/** id of the current link */
current?: string;
};
export type AppUser = {
name: string;
email: string;
};
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdnnpx ui8kit add app-shell// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/app-shell.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// AppShellProps are the props of AppShell; the values are the JSON shapes of the TypeScript props.
type AppShellProps struct {
Id any `json:"id"`
Title any `json:"title"`
Nav any `json:"nav"`
User any `json:"user"`
Search any `json:"search"`
Metrics any `json:"metrics"`
Chart any `json:"chart"`
Activity any `json:"activity"`
Layout any `json:"layout"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar is a port contract.
templ AppShell(p AppShellProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vNav := p.Nav }}
{{ vUser := p.User }}
{{ vSearch := p.Search }}
{{ vMetrics := p.Metrics }}
{{ vChart := p.Chart }}
{{ vActivity := p.Activity }}
{{ vLayout := uiutils.Def(p.Layout, "sidebar") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "section", Class: "bg-background", Attrs: uiutils.Attrs("aria-labelledby", uiutils.Cond(uiutils.T(vLandmarkLabel), nil, uiutils.Tpl("{0}-title", vId)), "data-layout", vLayout, "aria-label", vLandmarkLabel, "data-slot", "app-shell")}}) {
if uiutils.Eq(vLayout, "top") {
@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{}}) {
@NavBar(NavBarProps{Label: uiutils.Get(vNav, "label"), Brand: uiutils.Get(vNav, "brand"), Links: uiutils.Get(vNav, "links"), Current: uiutils.Get(vNav, "current"), Search: vSearch, Actions: map[string]any{"mode": "none"}, Layout: "search", LandmarkLabel: vLandmarkLabel})
@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full max-w-6xl px-4", "pb-8")), Attrs: uiutils.Attrs("data-slot", "container")}}) {
@AppMain(AppMainProps{Id: vId, Title: vTitle, Metrics: vMetrics, Chart: vChart, Cols: "1-4", Activity: vActivity, Density: vDensity})
}
}
} else {
@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full max-w-6xl px-4", "py-8")), Attrs: uiutils.Attrs("data-slot", "container")}}) {
if uiutils.Eq(vLayout, "sidebar") {
@compose.Grid(compose.GridProps{Cols: "1", BoxProps: box.BoxProps{Class: "items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]"}}) {
@SidebarNav(SidebarNavProps{Label: uiutils.Get(vNav, "label"), Brand: uiutils.Get(vNav, "brand"), Links: uiutils.Get(vNav, "links"), Current: uiutils.Get(vNav, "current"), UserName: uiutils.Get(vUser, "name"), UserEmail: uiutils.Get(vUser, "email"), Density: vDensity, LandmarkLabel: vLandmarkLabel})
@AppMain(AppMainProps{Id: vId, Title: vTitle, Metrics: vMetrics, Chart: vChart, Activity: vActivity, Density: vDensity})
}
} else {
@compose.Grid(compose.GridProps{Cols: "1-3", BoxProps: box.BoxProps{Class: "items-start gap-4"}}) {
@SidebarNav(SidebarNavProps{Label: uiutils.Get(vNav, "label"), Brand: uiutils.Get(vNav, "brand"), Links: uiutils.Get(vNav, "links"), Current: uiutils.Get(vNav, "current"), UserName: uiutils.Get(vUser, "name"), UserEmail: uiutils.Get(vUser, "email"), Width: "compact", Density: vDensity, LandmarkLabel: vLandmarkLabel})
if uiutils.Gt(uiutils.Len(uiutils.Get(vActivity, "events")), float64(0)) {
@Panel(PanelProps{Title: uiutils.Get(vActivity, "title"), Description: uiutils.Get(vActivity, "text"), Id: uiutils.Tpl("{0}-list", vId)}) {
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-4 p-0", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vE := range uiutils.L(uiutils.Get(vActivity, "events")) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-2", Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vE, "title")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vE, "time")) }
}
}
}
}
}
}
@AppMain(AppMainProps{Id: vId, Title: vTitle, Metrics: vMetrics, Chart: vChart, Density: "compact"})
}
}
}
}
}
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdnnpx ui8kit add app-shell{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/app-shell.json
The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar is a port contract.
Props (p): id, title, nav, user, search, metrics, chart, activity, layout, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_nav = (p.nav ?? null) -%}
{%- set v_user = (p.user ?? null) -%}
{%- set v_search = (p.search ?? null) -%}
{%- set v_metrics = (p.metrics ?? null) -%}
{%- set v_chart = (p.chart ?? null) -%}
{%- set v_activity = (p.activity ?? null) -%}
{%- set v_layout = (p.layout ?? 'sidebar') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_11 -%}
{%- if og_t(og_eq(v_layout, 'top')) %}
{%- set c_2 -%}
{{ include('blocks/nav-bar.html.twig', {'p': {'label': og_get(v_nav, ['label']), 'brand': og_get(v_nav, ['brand']), 'links': og_get(v_nav, ['links']), 'current': og_get(v_nav, ['current']), 'search': v_search, 'actions': {'mode': 'none'}, 'layout': 'search', 'landmarkLabel': v_landmarkLabel}}, with_context = false) }}
{%- set c_1 -%}
{{ include('blocks/app-main.html.twig', {'p': {'id': v_id, 'title': v_title, 'metrics': v_metrics, 'chart': v_chart, 'cols': '1-4', 'activity': v_activity, 'density': v_density}}, with_context = false) }}
{%- endset -%}
{{ include('compose/Container.html.twig', {'class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'pb-8'])), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'children': c_2}, with_context = false) }}
{%- else %}
{%- set c_10 -%}
{%- if og_t(og_eq(v_layout, 'sidebar')) %}
{%- set c_3 -%}
{{ include('blocks/sidebar-nav.html.twig', {'p': {'label': og_get(v_nav, ['label']), 'brand': og_get(v_nav, ['brand']), 'links': og_get(v_nav, ['links']), 'current': og_get(v_nav, ['current']), 'userName': og_get(v_user, ['name']), 'userEmail': og_get(v_user, ['email']), 'density': v_density, 'landmarkLabel': v_landmarkLabel}}, with_context = false) }}
{{ include('blocks/app-main.html.twig', {'p': {'id': v_id, 'title': v_title, 'metrics': v_metrics, 'chart': v_chart, 'activity': v_activity, 'density': v_density}}, with_context = false) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1', 'class': 'items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]', 'children': c_3}, with_context = false) }}
{%- else %}
{%- set c_9 -%}
{{ include('blocks/sidebar-nav.html.twig', {'p': {'label': og_get(v_nav, ['label']), 'brand': og_get(v_nav, ['brand']), 'links': og_get(v_nav, ['links']), 'current': og_get(v_nav, ['current']), 'userName': og_get(v_user, ['name']), 'userEmail': og_get(v_user, ['email']), 'width': 'compact', 'density': v_density, 'landmarkLabel': v_landmarkLabel}}, with_context = false) }}
{%- if og_t(og_gt(og_len(og_get(v_activity, ['events'])), 0)) %}
{%- set c_8 -%}
{%- set c_7 -%}
{%- for v_e in og_l(og_get(v_activity, ['events'])) %}
{%- set c_6 -%}
{%- set c_4 -%}
{{ og_text(og_get(v_e, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_e, ['time'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex flex-col gap-2', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_6}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-4 p-0', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_7}, with_context = false) }}
{%- endset -%}
{{ include('blocks/panel.html.twig', {'p': {'title': og_get(v_activity, ['title']), 'description': og_get(v_activity, ['text']), 'id': og_tpl('{0}-list', [v_id])}, 'children': og_markup(c_8)}, with_context = false) }}
{%- endif %}
{{ include('blocks/app-main.html.twig', {'p': {'id': v_id, 'title': v_title, 'metrics': v_metrics, 'chart': v_chart, 'density': 'compact'}}, with_context = false) }}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1-3', 'class': 'items-start gap-4', 'children': c_9}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Container.html.twig', {'class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'py-8'])), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_10}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'section', 'class': 'bg-background', 'attrs': og_attrs(['aria-labelledby', (og_t(v_landmarkLabel) ? null : og_tpl('{0}-title', [v_id])), 'data-layout', v_layout, 'aria-label', v_landmarkLabel, 'data-slot', 'app-shell']), 'children': c_11}, with_context = false) }}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdnnpx ui8kit add app-shell{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/app-shell.json
The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar is a port contract.
Props (p): id, title, nav, user, search, metrics, chart, activity, layout, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_nav = ($p['nav'] ?? null)}
{var $v_user = ($p['user'] ?? null)}
{var $v_search = ($p['search'] ?? null)}
{var $v_metrics = ($p['metrics'] ?? null)}
{var $v_chart = ($p['chart'] ?? null)}
{var $v_activity = ($p['activity'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'sidebar')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_11}
{if og_t(og_eq($v_layout, 'top'))}
{capture $c_2}
{=og_include('blocks/nav-bar.latte', ['p' => ['label' => og_get($v_nav, ['label']), 'brand' => og_get($v_nav, ['brand']), 'links' => og_get($v_nav, ['links']), 'current' => og_get($v_nav, ['current']), 'search' => $v_search, 'actions' => ['mode' => 'none'], 'layout' => 'search', 'landmarkLabel' => $v_landmarkLabel]])|noescape}
{capture $c_1}
{=og_include('blocks/app-main.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'metrics' => $v_metrics, 'chart' => $v_chart, 'cols' => '1-4', 'activity' => $v_activity, 'density' => $v_density]])|noescape}
{/capture}
{=og_include('compose/Container.latte', ['class' => og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'pb-8'])), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'children' => (string) $c_2])|noescape}
{else}
{capture $c_10}
{if og_t(og_eq($v_layout, 'sidebar'))}
{capture $c_3}
{=og_include('blocks/sidebar-nav.latte', ['p' => ['label' => og_get($v_nav, ['label']), 'brand' => og_get($v_nav, ['brand']), 'links' => og_get($v_nav, ['links']), 'current' => og_get($v_nav, ['current']), 'userName' => og_get($v_user, ['name']), 'userEmail' => og_get($v_user, ['email']), 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel]])|noescape}
{=og_include('blocks/app-main.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'metrics' => $v_metrics, 'chart' => $v_chart, 'activity' => $v_activity, 'density' => $v_density]])|noescape}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1', 'class' => 'items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]', 'children' => (string) $c_3])|noescape}
{else}
{capture $c_9}
{=og_include('blocks/sidebar-nav.latte', ['p' => ['label' => og_get($v_nav, ['label']), 'brand' => og_get($v_nav, ['brand']), 'links' => og_get($v_nav, ['links']), 'current' => og_get($v_nav, ['current']), 'userName' => og_get($v_user, ['name']), 'userEmail' => og_get($v_user, ['email']), 'width' => 'compact', 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel]])|noescape}
{if og_t(og_gt(og_len(og_get($v_activity, ['events'])), 0))}
{capture $c_8}
{capture $c_7}
{foreach og_l(og_get($v_activity, ['events'])) as $v_e}
{capture $c_6}
{capture $c_4}
{=og_text(og_get($v_e, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_get($v_e, ['time']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex flex-col gap-2', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_6])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-4 p-0', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_7])|noescape}
{/capture}
{=og_include('blocks/panel.latte', ['p' => ['title' => og_get($v_activity, ['title']), 'description' => og_get($v_activity, ['text']), 'id' => og_tpl('{0}-list', [$v_id])], 'children' => og_markup($c_8)])|noescape}
{/if}
{=og_include('blocks/app-main.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'metrics' => $v_metrics, 'chart' => $v_chart, 'density' => 'compact']])|noescape}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1-3', 'class' => 'items-start gap-4', 'children' => (string) $c_9])|noescape}
{/if}
{/capture}
{=og_include('compose/Container.latte', ['class' => og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'py-8'])), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_10])|noescape}
{/if}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'section', 'class' => 'bg-background', 'attrs' => og_attrs(['aria-labelledby', (og_t($v_landmarkLabel) ? null : og_tpl('{0}-title', [$v_id])), 'data-layout', $v_layout, 'aria-label', $v_landmarkLabel, 'data-slot', 'app-shell']), 'children' => (string) $c_11])|noescape}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdnnpx ui8kit add app-shell{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/app-shell.json
The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar is a port contract.
Props (p): id, title, nav, user, search, metrics, chart, activity, layout, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_nav = og_def(p['nav'], none) -%}
{%- set v_user = og_def(p['user'], none) -%}
{%- set v_search = og_def(p['search'], none) -%}
{%- set v_metrics = og_def(p['metrics'], none) -%}
{%- set v_chart = og_def(p['chart'], none) -%}
{%- set v_activity = og_def(p['activity'], none) -%}
{%- set v_layout = og_def(p['layout'], 'sidebar') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_11 -%}
{%- if og_t(og_eq(v_layout, 'top')) %}
{%- set c_2 -%}
{{ og_include('blocks/nav-bar.html.j2', {'p': {'label': og_get(v_nav, ['label']), 'brand': og_get(v_nav, ['brand']), 'links': og_get(v_nav, ['links']), 'current': og_get(v_nav, ['current']), 'search': v_search, 'actions': {'mode': 'none'}, 'layout': 'search', 'landmarkLabel': v_landmarkLabel}}) }}
{%- set c_1 -%}
{{ og_include('blocks/app-main.html.j2', {'p': {'id': v_id, 'title': v_title, 'metrics': v_metrics, 'chart': v_chart, 'cols': '1-4', 'activity': v_activity, 'density': v_density}}) }}
{%- endset -%}
{{ og_include('compose/container.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'pb-8'])), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch'}, 'children': c_2}) }}
{%- else %}
{%- set c_10 -%}
{%- if og_t(og_eq(v_layout, 'sidebar')) %}
{%- set c_3 -%}
{{ og_include('blocks/sidebar-nav.html.j2', {'p': {'label': og_get(v_nav, ['label']), 'brand': og_get(v_nav, ['brand']), 'links': og_get(v_nav, ['links']), 'current': og_get(v_nav, ['current']), 'userName': og_get(v_user, ['name']), 'userEmail': og_get(v_user, ['email']), 'density': v_density, 'landmarkLabel': v_landmarkLabel}}) }}
{{ og_include('blocks/app-main.html.j2', {'p': {'id': v_id, 'title': v_title, 'metrics': v_metrics, 'chart': v_chart, 'activity': v_activity, 'density': v_density}}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1', 'Class': 'items-start gap-6 md:grid-cols-[16rem_minmax(0,1fr)]'}, 'children': c_3}) }}
{%- else %}
{%- set c_9 -%}
{{ og_include('blocks/sidebar-nav.html.j2', {'p': {'label': og_get(v_nav, ['label']), 'brand': og_get(v_nav, ['brand']), 'links': og_get(v_nav, ['links']), 'current': og_get(v_nav, ['current']), 'userName': og_get(v_user, ['name']), 'userEmail': og_get(v_user, ['email']), 'width': 'compact', 'density': v_density, 'landmarkLabel': v_landmarkLabel}}) }}
{%- if og_t(og_gt(og_len(og_get(v_activity, ['events'])), 0)) %}
{%- set c_8 -%}
{%- set c_7 -%}
{%- for v_e in og_l(og_get(v_activity, ['events'])) %}
{%- set c_6 -%}
{%- set c_4 -%}
{{ og_text(og_get(v_e, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_e, ['time'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex flex-col gap-2', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_6}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-4 p-0', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_7}) }}
{%- endset -%}
{{ og_include('blocks/panel.html.j2', {'p': {'title': og_get(v_activity, ['title']), 'description': og_get(v_activity, ['text']), 'id': og_tpl('{0}-list', [v_id])}, 'children': og_markup(c_8)}) }}
{%- endif %}
{{ og_include('blocks/app-main.html.j2', {'p': {'id': v_id, 'title': v_title, 'metrics': v_metrics, 'chart': v_chart, 'density': 'compact'}}) }}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1-3', 'Class': 'items-start gap-4'}, 'children': c_9}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/container.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'py-8'])), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_10}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'section', 'Class': 'bg-background', 'Attrs': og_attrs(['aria-labelledby', (none if og_t(v_landmarkLabel) else og_tpl('{0}-title', [v_id])), 'data-layout', v_layout, 'aria-label', v_landmarkLabel, 'data-slot', 'app-shell'])}, 'children': c_11}) }}
Props
Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.
The frame of a signed-in app with a first screen in it. Axes: layout (sidebar: navigation on the left, top: a bar above the content, panes: a narrow navigation, a list and a detail), density. The collapse of the sidebar is a port contract.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| nav (required) | AppNav | - | the navigation (sidebar or top bar) |
| user (required) | AppUser | - | the signed-in person, under the sidebar |
| search (required) | NavSearch | - | the search field of the top bar |
| metrics (required) | Metric[] | - | |
| chart (required) | OverviewChart | - | |
| activity (required) | OverviewActivity | - | |
| layout | "sidebar" | "top" | "panes" | "sidebar" | |
| density | "default" | "compact" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |