Shell Sidebar
Shell Sidebar component
Install
npx ui8kit add shell-sidebarPulls in: block, box, button-plain, compose, dashboard-shell, group, inline, kit-box, kit-button, kit-text, list, list-item, lucide-icon, menu-entry, nav-block, text, utils
Preview
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 shell-sidebar<!-- 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 sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read),
collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a
panel of the current section's links). side puts it at the start or the end.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { ShellNav } from "../blocks/dashboard-shell.types";
export type ShellSidebarProps = {
nav: ShellNav;
mode?: "wide" | "rail" | "collapsed" | "twolevel" | "none";
side?: "start" | "end";
brand?: "show" | "hide";
landmarkLabel?: string;
ontoggle?: () => void;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Box from "../compose/Box.svelte";
import ButtonPlain from "../compose/ButtonPlain.svelte";
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Text from "../compose/Text.svelte";
import MenuEntry from "../components/menu-entry.svelte";
import NavBlock from "../components/nav-block.svelte";
import { cn, tpl, uniqLabel } from "../utils";
let {
nav,
mode = "wide",
side = "start",
brand = "show",
landmarkLabel,
ontoggle,
}: ShellSidebarProps = $props();
const named = $derived((mode as string) === "wide");
</script>
<Block
tag="aside"
class={cn(
"flex shrink-0 bg-card",
(
(side as string) === "end" ? "flex-row-reverse border-l border-border"
: "border-r border-border"
)
)}
aria-label={(landmarkLabel ?? nav.label)}
data-mode={mode}
data-slot="sidebar"
>
<Box class={cn("flex flex-col gap-6 py-4", (named ? "w-64 px-4" : "w-16 items-center px-2"))}>
{#if ((brand as string) === "show")}
<Group gap="2" align="center" class="shrink-0" data-slot="brand">
<LucideIcon name="layers" size={24} />
<Text size="base" weight="bold" class={(named ? "" : "sr-only")}>
{nav.brand}
</Text>
</Group>
{/if}
{#if ((nav.links?.length ?? 0) > 0)}
<NavBlock
label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", nav.label, landmarkLabel)) : nav.label)}
class="flex-1"
>
<List class="m-0 flex list-none flex-col gap-2 p-0" data-slot="items">
{#each nav.links as l (l.id)}
<ListItem data-slot="links-row">
<MenuEntry
href={l.href}
class={cn(
"flex items-center gap-4 rounded py-2 text-sm",
(named ? "px-4" : "justify-center px-2"),
((l.id === nav.current) ? "bg-muted font-medium" : "")
)}
current={(l.id === nav.current)}
size="sm"
testid="item"
>
<LucideIcon name={l.icon} size={16} />
<Inline class={(named ? "" : "sr-only")}>
{l.name}
</Inline>
</MenuEntry>
</ListItem>
{/each}
</List>
</NavBlock>
{/if}
{#if ((mode as string) === "collapsed")}
<ButtonPlain
type="button"
class="inline-flex size-10 items-center justify-center rounded text-muted-foreground"
aria-label={nav.expand}
aria-expanded={(((mode as string) === "wide") ? "true" : "false")}
data-slot="toggle"
onclick={() => ontoggle?.()}
>
<LucideIcon name="panel-left" size={20} />
</ButtonPlain>
{/if}
</Box>
{#if (((mode as string) === "twolevel") && ((nav.sub?.length ?? 0) > 0))}
<Box
class={cn(
"flex w-56 flex-col gap-4 px-4 py-6",
(((side as string) === "end") ? "border-r border-border" : "border-l border-border")
)}
data-slot="subnav"
>
<Text size="sm" weight="semibold" class="px-4">
{nav.subTitle}
</Text>
<NavBlock label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", nav.subTitle, landmarkLabel)) : nav.subTitle)}>
<List class="m-0 flex list-none flex-col gap-2 p-0">
{#each nav.sub as s (s.id)}
<ListItem data-slot="sub-row">
<MenuEntry
href={s.href}
class={cn(
"flex items-center gap-4 rounded py-2 text-sm",
(true ? "px-4" : "justify-center px-2"),
((s.id === nav.subCurrent) ? "bg-muted font-medium" : "")
)}
current={(s.id === nav.subCurrent)}
size="sm"
testid="item"
>
<LucideIcon name={s.icon} size={16} />
<Inline class={(true ? "" : "sr-only")}>
{s.name}
</Inline>
</MenuEntry>
</ListItem>
{/each}
</List>
</NavBlock>
</Box>
{/if}
</Block>
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 shell-sidebar// 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 sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read),
* collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a
* panel of the current section's links). side puts it at the start or the end.
*/
import { type ReactNode } from "react";
import { Block, Box, ButtonPlain, Group, Inline, List, ListItem, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MenuEntry } from "../components/menu-entry";
import { NavBlock } from "../components/nav-block";
import { cn, tpl, uniqLabel } from "../utils";
import type { ShellNav } from "../blocks/dashboard-shell.types";
export type ShellSidebarProps = {
nav: ShellNav;
mode?: "wide" | "rail" | "collapsed" | "twolevel" | "none";
side?: "start" | "end";
brand?: "show" | "hide";
landmarkLabel?: string;
onToggle?: () => void;
};
export function ShellSidebar({
nav,
mode = "wide",
side = "start",
brand = "show",
landmarkLabel,
onToggle,
}: ShellSidebarProps) {
const named = (mode as string) === "wide";
return (
<Block
tag="aside"
className={cn(
"flex shrink-0 bg-card",
(
(side as string) === "end" ? "flex-row-reverse border-l border-border"
: "border-r border-border"
)
)}
aria-label={(landmarkLabel ?? nav.label)}
data-mode={mode}
data-slot="sidebar"
>
<Box className={cn("flex flex-col gap-6 py-4", (named ? "w-64 px-4" : "w-16 items-center px-2"))}>
{((brand as string) === "show") ? (
<Group gap="2" align="center" className="shrink-0" data-slot="brand">
<LucideIcon name="layers" size={24} />
<Text size="base" weight="bold" className={(named ? "" : "sr-only")}>
{nav.brand}
</Text>
</Group>
) : null}
{((nav.links?.length ?? 0) > 0) ? (
<NavBlock
label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", nav.label, landmarkLabel)) : nav.label)}
className="flex-1"
>
<List className="m-0 flex list-none flex-col gap-2 p-0" data-slot="items">
{(nav.links ?? []).map((l) => (
<ListItem key={l.id} data-slot="links-row">
<MenuEntry
href={l.href}
className={cn(
"flex items-center gap-4 rounded py-2 text-sm",
(named ? "px-4" : "justify-center px-2"),
((l.id === nav.current) ? "bg-muted font-medium" : "")
)}
current={(l.id === nav.current)}
size="sm"
testid="item"
>
<LucideIcon name={l.icon} size={16} />
<Inline className={(named ? "" : "sr-only")}>
{l.name}
</Inline>
</MenuEntry>
</ListItem>
))}
</List>
</NavBlock>
) : null}
{((mode as string) === "collapsed") ? (
<ButtonPlain
type="button"
className="inline-flex size-10 items-center justify-center rounded text-muted-foreground"
aria-label={nav.expand}
aria-expanded={(((mode as string) === "wide") ? "true" : "false")}
data-slot="toggle"
onClick={() => onToggle?.()}
>
<LucideIcon name="panel-left" size={20} />
</ButtonPlain>
) : null}
</Box>
{(((mode as string) === "twolevel") && ((nav.sub?.length ?? 0) > 0)) ? (
<Box
className={cn(
"flex w-56 flex-col gap-4 px-4 py-6",
(((side as string) === "end") ? "border-r border-border" : "border-l border-border")
)}
data-slot="subnav"
>
<Text size="sm" weight="semibold" className="px-4">
{nav.subTitle}
</Text>
<NavBlock label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", nav.subTitle, landmarkLabel)) : nav.subTitle)}>
<List className="m-0 flex list-none flex-col gap-2 p-0">
{(nav.sub ?? []).map((s) => (
<ListItem key={s.id} data-slot="sub-row">
<MenuEntry
href={s.href}
className={cn(
"flex items-center gap-4 rounded py-2 text-sm",
(true ? "px-4" : "justify-center px-2"),
((s.id === nav.subCurrent) ? "bg-muted font-medium" : "")
)}
current={(s.id === nav.subCurrent)}
size="sm"
testid="item"
>
<LucideIcon name={s.icon} size={16} />
<Inline className={(true ? "" : "sr-only")}>
{s.name}
</Inline>
</MenuEntry>
</ListItem>
))}
</List>
</NavBlock>
</Box>
) : null}
</Block>
);
}
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 shell-sidebar<!-- 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 sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read),
collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a
panel of the current section's links). side puts it at the start or the end.
-->
<script lang="ts">
import type { ShellNav } from "../blocks/dashboard-shell.types";
export type ShellSidebarProps = {
nav: ShellNav;
mode?: "wide" | "rail" | "collapsed" | "twolevel" | "none";
side?: "start" | "end";
brand?: "show" | "hide";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import { computed } from "vue";
import Block from "../compose/Block.vue";
import Box from "../compose/Box.vue";
import ButtonPlain from "../compose/ButtonPlain.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Text from "../compose/Text.vue";
import MenuEntry from "../components/menu-entry.vue";
import NavBlock from "../components/nav-block.vue";
import { cn, tpl, uniqLabel } from "../utils";
const {
nav,
mode = "wide",
side = "start",
brand = "show",
landmarkLabel,
} = defineProps<ShellSidebarProps>();
const emit = defineEmits<{ toggle: [] }>();
const named = computed(() => (mode as string) === "wide");
</script>
<template>
<Block
tag="aside"
:class="cn(
'flex shrink-0 bg-card',
(
(side as string) === 'end' ? 'flex-row-reverse border-l border-border'
: 'border-r border-border'
)
)"
:aria-label="(landmarkLabel ?? nav.label)"
:data-mode="mode"
data-slot="sidebar"
>
<Box :class="cn('flex flex-col gap-6 py-4', (named ? 'w-64 px-4' : 'w-16 items-center px-2'))">
<Group v-if="((brand as string) === 'show')" gap="2" align="center" class="shrink-0" data-slot="brand">
<LucideIcon name="layers" :size="24" />
<Text size="base" weight="bold" :class="(named ? '' : 'sr-only')">
{{ nav.brand }}
</Text>
</Group>
<NavBlock v-if="((nav.links?.length ?? 0) > 0)"
:label="(landmarkLabel ? uniqLabel(tpl('{0}, {1}', nav.label, landmarkLabel)) : nav.label)"
class="flex-1"
>
<List class="m-0 flex list-none flex-col gap-2 p-0" data-slot="items">
<ListItem v-for="l in nav.links" :key="l.id" data-slot="links-row">
<MenuEntry
:href="l.href"
:class="cn(
'flex items-center gap-4 rounded py-2 text-sm',
(named ? 'px-4' : 'justify-center px-2'),
((l.id === nav.current) ? 'bg-muted font-medium' : '')
)"
:current="(l.id === nav.current)"
size="sm"
testid="item"
>
<LucideIcon :name="l.icon" :size="16" />
<Inline :class="(named ? '' : 'sr-only')">
{{ l.name }}
</Inline>
</MenuEntry>
</ListItem>
</List>
</NavBlock>
<ButtonPlain v-if="((mode as string) === 'collapsed')"
type="button"
class="inline-flex size-10 items-center justify-center rounded text-muted-foreground"
:aria-label="nav.expand"
:aria-expanded="(((mode as string) === 'wide') ? 'true' : 'false')"
data-slot="toggle"
@click="() => emit('toggle')"
>
<LucideIcon name="panel-left" :size="20" />
</ButtonPlain>
</Box>
<Box v-if="(((mode as string) === 'twolevel') && ((nav.sub?.length ?? 0) > 0))"
:class="cn(
'flex w-56 flex-col gap-4 px-4 py-6',
(((side as string) === 'end') ? 'border-r border-border' : 'border-l border-border')
)"
data-slot="subnav"
>
<Text size="sm" weight="semibold" class="px-4">
{{ nav.subTitle }}
</Text>
<NavBlock :label="(landmarkLabel ? uniqLabel(tpl('{0}, {1}', nav.subTitle, landmarkLabel)) : nav.subTitle)">
<List class="m-0 flex list-none flex-col gap-2 p-0">
<ListItem v-for="s in nav.sub" :key="s.id" data-slot="sub-row">
<MenuEntry
:href="s.href"
:class="cn(
'flex items-center gap-4 rounded py-2 text-sm',
(true ? 'px-4' : 'justify-center px-2'),
((s.id === nav.subCurrent) ? 'bg-muted font-medium' : '')
)"
:current="(s.id === nav.subCurrent)"
size="sm"
testid="item"
>
<LucideIcon :name="s.icon" :size="16" />
<Inline :class="(true ? '' : 'sr-only')">
{{ s.name }}
</Inline>
</MenuEntry>
</ListItem>
</List>
</NavBlock>
</Box>
</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 shell-sidebar// 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 sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read),
* collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a
* panel of the current section's links). side puts it at the start or the end.
*/
import { For, type JSX } from "solid-js";
import { Block, Box, ButtonPlain, Group, Inline, List, ListItem, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MenuEntry } from "../components/menu-entry";
import { NavBlock } from "../components/nav-block";
import { cn, tpl, uniqLabel } from "../utils";
import type { ShellNav } from "../blocks/dashboard-shell.types";
export type ShellSidebarProps = {
nav: ShellNav;
mode?: "wide" | "rail" | "collapsed" | "twolevel" | "none";
side?: "start" | "end";
brand?: "show" | "hide";
landmarkLabel?: string;
onToggle?: () => void;
};
export function ShellSidebar({
nav,
mode = "wide",
side = "start",
brand = "show",
landmarkLabel,
onToggle,
}: ShellSidebarProps) {
const named = (mode as string) === "wide";
return (
<Block
tag="aside"
class={cn(
"flex shrink-0 bg-card",
(
(side as string) === "end" ? "flex-row-reverse border-l border-border"
: "border-r border-border"
)
)}
aria-label={(landmarkLabel ?? nav.label)}
data-mode={mode}
data-slot="sidebar"
>
<Box class={cn("flex flex-col gap-6 py-4", (named ? "w-64 px-4" : "w-16 items-center px-2"))}>
{((brand as string) === "show") ? (
<Group gap="2" align="center" class="shrink-0" data-slot="brand">
<LucideIcon name="layers" size={24} />
<Text size="base" weight="bold" class={(named ? "" : "sr-only")}>
{nav.brand}
</Text>
</Group>
) : null}
{((nav.links?.length ?? 0) > 0) ? (
<NavBlock
label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", nav.label, landmarkLabel)) : nav.label)}
class="flex-1"
>
<List class="m-0 flex list-none flex-col gap-2 p-0" data-slot="items">
<For each={nav.links ?? []}>{(l) => (
<ListItem data-slot="links-row">
<MenuEntry
href={l.href}
class={cn(
"flex items-center gap-4 rounded py-2 text-sm",
(named ? "px-4" : "justify-center px-2"),
((l.id === nav.current) ? "bg-muted font-medium" : "")
)}
current={(l.id === nav.current)}
size="sm"
testid="item"
>
<LucideIcon name={l.icon} size={16} />
<Inline class={(named ? "" : "sr-only")}>
{l.name}
</Inline>
</MenuEntry>
</ListItem>
)}</For>
</List>
</NavBlock>
) : null}
{((mode as string) === "collapsed") ? (
<ButtonPlain
type="button"
class="inline-flex size-10 items-center justify-center rounded text-muted-foreground"
aria-label={nav.expand}
aria-expanded={(((mode as string) === "wide") ? "true" : "false")}
data-slot="toggle"
onClick={() => onToggle?.()}
>
<LucideIcon name="panel-left" size={20} />
</ButtonPlain>
) : null}
</Box>
{(((mode as string) === "twolevel") && ((nav.sub?.length ?? 0) > 0)) ? (
<Box
class={cn(
"flex w-56 flex-col gap-4 px-4 py-6",
(((side as string) === "end") ? "border-r border-border" : "border-l border-border")
)}
data-slot="subnav"
>
<Text size="sm" weight="semibold" class="px-4">
{nav.subTitle}
</Text>
<NavBlock label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", nav.subTitle, landmarkLabel)) : nav.subTitle)}>
<List class="m-0 flex list-none flex-col gap-2 p-0">
<For each={nav.sub ?? []}>{(s) => (
<ListItem data-slot="sub-row">
<MenuEntry
href={s.href}
class={cn(
"flex items-center gap-4 rounded py-2 text-sm",
(true ? "px-4" : "justify-center px-2"),
((s.id === nav.subCurrent) ? "bg-muted font-medium" : "")
)}
current={(s.id === nav.subCurrent)}
size="sm"
testid="item"
>
<LucideIcon name={s.icon} size={16} />
<Inline class={(true ? "" : "sr-only")}>
{s.name}
</Inline>
</MenuEntry>
</ListItem>
)}</For>
</List>
</NavBlock>
</Box>
) : null}
</Block>
);
}
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 shell-sidebar// 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/shell-sidebar.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/ui/button"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// ShellSidebarProps are the props of ShellSidebar; the values are the JSON shapes of the TypeScript props.
type ShellSidebarProps struct {
Nav any `json:"nav"`
Mode any `json:"mode"`
Side any `json:"side"`
Brand any `json:"brand"`
LandmarkLabel any `json:"landmarkLabel"`
}
// The sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read), collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a panel of the current section's links). side puts it at the start or the end.
templ ShellSidebar(p ShellSidebarProps) {
{{ vNav := p.Nav }}
{{ vMode := uiutils.Def(p.Mode, "wide") }}
{{ vSide := uiutils.Def(p.Side, "start") }}
{{ vBrand := uiutils.Def(p.Brand, "show") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
{{ vNamed := any(uiutils.Eq(vMode, "wide")) }}
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "aside", Class: uiutils.S(uiutils.Cnv("flex shrink-0 bg-card", uiutils.Cond(uiutils.T(uiutils.Eq(vSide, "end")), "flex-row-reverse border-l border-border", "border-r border-border"))), Attrs: uiutils.Attrs("aria-label", uiutils.Coalesce(vLandmarkLabel, uiutils.Get(vNav, "label")), "data-mode", vMode, "data-slot", "sidebar")}}) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex flex-col gap-6 py-4", uiutils.Cond(uiutils.T(vNamed), "w-64 px-4", "w-16 items-center px-2")))}}) {
if uiutils.Eq(vBrand, "show") {
@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Class: "shrink-0", Attrs: uiutils.Attrs("data-slot", "brand")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: "layers", Size: 24})
@compose.Text(compose.TextProps{Size: "base", Weight: "bold", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cond(uiutils.T(vNamed), "", "sr-only"))}}) {
{ uiutils.Text(uiutils.Get(vNav, "brand")) }
}
}
}
if uiutils.Gt(uiutils.Len(uiutils.Get(vNav, "links")), float64(0)) {
@NavBlock(NavBlockProps{Label: uiutils.Cond(uiutils.T(vLandmarkLabel), uiutils.Uniq(uiutils.Tpl("{0}, {1}", uiutils.Get(vNav, "label"), vLandmarkLabel)), uiutils.Get(vNav, "label")), Class: uiutils.Cnv("flex-1")}) {
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-2 p-0", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vL := range uiutils.L(uiutils.Get(vNav, "links")) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "links-row")}}) {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vL, "href"), Class: uiutils.Cnv(uiutils.Cnv("flex items-center gap-4 rounded py-2 text-sm", uiutils.Cond(uiutils.T(vNamed), "px-4", "justify-center px-2"), uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vL, "id"), uiutils.Get(vNav, "current"))), "bg-muted font-medium", ""))), Current: uiutils.Eq(uiutils.Get(vL, "id"), uiutils.Get(vNav, "current")), Size: "sm", Testid: "item"}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vL, "icon")), Size: 16})
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: uiutils.S(uiutils.Cond(uiutils.T(vNamed), "", "sr-only"))}}) {
{ uiutils.Text(uiutils.Get(vL, "name")) }
}
}
}
}
}
}
}
if uiutils.Eq(vMode, "collapsed") {
@compose.ButtonPlain(compose.ButtonPlainProps{ButtonProps: button.ButtonProps{Type: "button", Class: "inline-flex size-10 items-center justify-center rounded text-muted-foreground", Attrs: uiutils.Attrs("aria-label", uiutils.Get(vNav, "expand"), "aria-expanded", uiutils.Cond(uiutils.T(uiutils.Eq(vMode, "wide")), "true", "false"), "data-slot", "toggle")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: "panel-left", Size: 20})
}
}
}
if uiutils.T(uiutils.And(uiutils.Eq(vMode, "twolevel"), uiutils.Gt(uiutils.Len(uiutils.Get(vNav, "sub")), float64(0)))) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex w-56 flex-col gap-4 px-4 py-6", uiutils.Cond(uiutils.T(uiutils.Eq(vSide, "end")), "border-r border-border", "border-l border-border"))), Attrs: uiutils.Attrs("data-slot", "subnav")}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{Class: "px-4"}}) {
{ uiutils.Text(uiutils.Get(vNav, "subTitle")) }
}
@NavBlock(NavBlockProps{Label: uiutils.Cond(uiutils.T(vLandmarkLabel), uiutils.Uniq(uiutils.Tpl("{0}, {1}", uiutils.Get(vNav, "subTitle"), vLandmarkLabel)), uiutils.Get(vNav, "subTitle"))}) {
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-2 p-0"}}) {
for _, vS := range uiutils.L(uiutils.Get(vNav, "sub")) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "sub-row")}}) {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vS, "href"), Class: uiutils.Cnv(uiutils.Cnv("flex items-center gap-4 rounded py-2 text-sm", uiutils.Cond(uiutils.T(true), "px-4", "justify-center px-2"), uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vS, "id"), uiutils.Get(vNav, "subCurrent"))), "bg-muted font-medium", ""))), Current: uiutils.Eq(uiutils.Get(vS, "id"), uiutils.Get(vNav, "subCurrent")), Size: "sm", Testid: "item"}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vS, "icon")), Size: 16})
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: uiutils.S(uiutils.Cond(uiutils.T(true), "", "sr-only"))}}) {
{ uiutils.Text(uiutils.Get(vS, "name")) }
}
}
}
}
}
}
}
}
}
}
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 shell-sidebar{#- 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/shell-sidebar.json
The sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read), collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a panel of the current section's links). side puts it at the start or the end.
Props (p): nav, mode, side, brand, landmarkLabel. -#}
{%- set v_nav = (p.nav ?? null) -%}
{%- set v_mode = (p.mode ?? 'wide') -%}
{%- set v_side = (p.side ?? 'start') -%}
{%- set v_brand = (p.brand ?? 'show') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set v_named = og_eq(v_mode, 'wide') -%}
{%- set c_17 -%}
{%- set c_9 -%}
{%- if og_t(og_eq(v_brand, 'show')) %}
{%- set c_2 -%}
{{ include('icons/LucideIcon.html.twig', {'name': 'layers', 'size': 24}, with_context = false) }}
{%- set c_1 -%}
{{ og_text(og_get(v_nav, ['brand'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'bold', 'class': og_s((og_t(v_named) ? '' : 'sr-only')), 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'class': 'shrink-0', 'attrs': og_attrs(['data-slot', 'brand']), 'children': c_2}, with_context = false) }}
{%- endif %}
{%- if og_t(og_gt(og_len(og_get(v_nav, ['links'])), 0)) %}
{%- set c_7 -%}
{%- set c_6 -%}
{%- for v_l in og_l(og_get(v_nav, ['links'])) %}
{%- set c_5 -%}
{%- set c_4 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_l, ['icon'])), 'size': 16}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_l, ['name'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': og_s((og_t(v_named) ? '' : 'sr-only')), 'children': c_3}, with_context = false) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_l, ['href']), 'className': og_cnv([og_cnv(['flex items-center gap-4 rounded py-2 text-sm', (og_t(v_named) ? 'px-4' : 'justify-center px-2'), (og_t(og_eq(og_get(v_l, ['id']), og_get(v_nav, ['current']))) ? 'bg-muted font-medium' : '')])]), 'current': og_eq(og_get(v_l, ['id']), og_get(v_nav, ['current'])), 'size': 'sm', 'testid': 'item'}, 'children': og_markup(c_4)}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'attrs': og_attrs(['data-slot', 'links-row']), 'children': c_5}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-2 p-0', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('blocks/nav-block.html.twig', {'p': {'label': (og_t(v_landmarkLabel) ? og_uniq(og_tpl('{0}, {1}', [og_get(v_nav, ['label']), v_landmarkLabel])) : og_get(v_nav, ['label'])), 'className': og_cnv(['flex-1'])}, 'children': og_markup(c_7)}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(v_mode, 'collapsed')) %}
{%- set c_8 -%}
{{ include('icons/LucideIcon.html.twig', {'name': 'panel-left', 'size': 20}, with_context = false) }}
{%- endset -%}
{{ include('compose/ButtonPlain.html.twig', {'type': 'button', 'class': 'inline-flex size-10 items-center justify-center rounded text-muted-foreground', 'attrs': og_attrs(['aria-label', og_get(v_nav, ['expand']), 'aria-expanded', (og_t(og_eq(v_mode, 'wide')) ? 'true' : 'false'), 'data-slot', 'toggle']), 'children': c_8}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['flex flex-col gap-6 py-4', (og_t(v_named) ? 'w-64 px-4' : 'w-16 items-center px-2')])), 'children': c_9}, with_context = false) }}
{%- if og_t(og_and([og_eq(v_mode, 'twolevel'), og_gt(og_len(og_get(v_nav, ['sub'])), 0)])) %}
{%- set c_16 -%}
{%- set c_10 -%}
{{ og_text(og_get(v_nav, ['subTitle'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'class': 'px-4', 'children': c_10}, with_context = false) }}
{%- set c_15 -%}
{%- set c_14 -%}
{%- for v_s in og_l(og_get(v_nav, ['sub'])) %}
{%- set c_13 -%}
{%- set c_12 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_s, ['icon'])), 'size': 16}, with_context = false) }}
{%- set c_11 -%}
{{ og_text(og_get(v_s, ['name'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': og_s((og_t(true) ? '' : 'sr-only')), 'children': c_11}, with_context = false) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_s, ['href']), 'className': og_cnv([og_cnv(['flex items-center gap-4 rounded py-2 text-sm', (og_t(true) ? 'px-4' : 'justify-center px-2'), (og_t(og_eq(og_get(v_s, ['id']), og_get(v_nav, ['subCurrent']))) ? 'bg-muted font-medium' : '')])]), 'current': og_eq(og_get(v_s, ['id']), og_get(v_nav, ['subCurrent'])), 'size': 'sm', 'testid': 'item'}, 'children': og_markup(c_12)}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'attrs': og_attrs(['data-slot', 'sub-row']), 'children': c_13}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-2 p-0', 'children': c_14}, with_context = false) }}
{%- endset -%}
{{ include('blocks/nav-block.html.twig', {'p': {'label': (og_t(v_landmarkLabel) ? og_uniq(og_tpl('{0}, {1}', [og_get(v_nav, ['subTitle']), v_landmarkLabel])) : og_get(v_nav, ['subTitle']))}, 'children': og_markup(c_15)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['flex w-56 flex-col gap-4 px-4 py-6', (og_t(og_eq(v_side, 'end')) ? 'border-r border-border' : 'border-l border-border')])), 'attrs': og_attrs(['data-slot', 'subnav']), 'children': c_16}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'aside', 'class': og_s(og_cnv(['flex shrink-0 bg-card', (og_t(og_eq(v_side, 'end')) ? 'flex-row-reverse border-l border-border' : 'border-r border-border')])), 'attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, og_get(v_nav, ['label'])]), 'data-mode', v_mode, 'data-slot', 'sidebar']), 'children': c_17}, 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 shell-sidebar{* 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/shell-sidebar.json
The sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read), collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a panel of the current section's links). side puts it at the start or the end.
Props (p): nav, mode, side, brand, landmarkLabel. *}
{var $v_nav = ($p['nav'] ?? null)}
{var $v_mode = ($p['mode'] ?? 'wide')}
{var $v_side = ($p['side'] ?? 'start')}
{var $v_brand = ($p['brand'] ?? 'show')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{var $v_named = og_eq($v_mode, 'wide')}
{capture $c_17}
{capture $c_9}
{if og_t(og_eq($v_brand, 'show'))}
{capture $c_2}
{=og_include('icons/LucideIcon.latte', ['name' => 'layers', 'size' => 24])|noescape}
{capture $c_1}
{=og_text(og_get($v_nav, ['brand']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'bold', 'class' => og_s((og_t($v_named) ? '' : 'sr-only')), 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'class' => 'shrink-0', 'attrs' => og_attrs(['data-slot', 'brand']), 'children' => (string) $c_2])|noescape}
{/if}
{if og_t(og_gt(og_len(og_get($v_nav, ['links'])), 0))}
{capture $c_7}
{capture $c_6}
{foreach og_l(og_get($v_nav, ['links'])) as $v_l}
{capture $c_5}
{capture $c_4}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_l, ['icon'])), 'size' => 16])|noescape}
{capture $c_3}
{=og_text(og_get($v_l, ['name']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => og_s((og_t($v_named) ? '' : 'sr-only')), 'children' => (string) $c_3])|noescape}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_l, ['href']), 'className' => og_cnv([og_cnv(['flex items-center gap-4 rounded py-2 text-sm', (og_t($v_named) ? 'px-4' : 'justify-center px-2'), (og_t(og_eq(og_get($v_l, ['id']), og_get($v_nav, ['current']))) ? 'bg-muted font-medium' : '')])]), 'current' => og_eq(og_get($v_l, ['id']), og_get($v_nav, ['current'])), 'size' => 'sm', 'testid' => 'item'], 'children' => og_markup($c_4)])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['attrs' => og_attrs(['data-slot', 'links-row']), 'children' => (string) $c_5])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-2 p-0', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('blocks/nav-block.latte', ['p' => ['label' => (og_t($v_landmarkLabel) ? og_uniq(og_tpl('{0}, {1}', [og_get($v_nav, ['label']), $v_landmarkLabel])) : og_get($v_nav, ['label'])), 'className' => og_cnv(['flex-1'])], 'children' => og_markup($c_7)])|noescape}
{/if}
{if og_t(og_eq($v_mode, 'collapsed'))}
{capture $c_8}
{=og_include('icons/LucideIcon.latte', ['name' => 'panel-left', 'size' => 20])|noescape}
{/capture}
{=og_include('compose/ButtonPlain.latte', ['type' => 'button', 'class' => 'inline-flex size-10 items-center justify-center rounded text-muted-foreground', 'attrs' => og_attrs(['aria-label', og_get($v_nav, ['expand']), 'aria-expanded', (og_t(og_eq($v_mode, 'wide')) ? 'true' : 'false'), 'data-slot', 'toggle']), 'children' => (string) $c_8])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['flex flex-col gap-6 py-4', (og_t($v_named) ? 'w-64 px-4' : 'w-16 items-center px-2')])), 'children' => (string) $c_9])|noescape}
{if og_t(og_and([og_eq($v_mode, 'twolevel'), og_gt(og_len(og_get($v_nav, ['sub'])), 0)]))}
{capture $c_16}
{capture $c_10}
{=og_text(og_get($v_nav, ['subTitle']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'class' => 'px-4', 'children' => (string) $c_10])|noescape}
{capture $c_15}
{capture $c_14}
{foreach og_l(og_get($v_nav, ['sub'])) as $v_s}
{capture $c_13}
{capture $c_12}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_s, ['icon'])), 'size' => 16])|noescape}
{capture $c_11}
{=og_text(og_get($v_s, ['name']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => og_s((og_t(true) ? '' : 'sr-only')), 'children' => (string) $c_11])|noescape}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_s, ['href']), 'className' => og_cnv([og_cnv(['flex items-center gap-4 rounded py-2 text-sm', (og_t(true) ? 'px-4' : 'justify-center px-2'), (og_t(og_eq(og_get($v_s, ['id']), og_get($v_nav, ['subCurrent']))) ? 'bg-muted font-medium' : '')])]), 'current' => og_eq(og_get($v_s, ['id']), og_get($v_nav, ['subCurrent'])), 'size' => 'sm', 'testid' => 'item'], 'children' => og_markup($c_12)])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['attrs' => og_attrs(['data-slot', 'sub-row']), 'children' => (string) $c_13])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-2 p-0', 'children' => (string) $c_14])|noescape}
{/capture}
{=og_include('blocks/nav-block.latte', ['p' => ['label' => (og_t($v_landmarkLabel) ? og_uniq(og_tpl('{0}, {1}', [og_get($v_nav, ['subTitle']), $v_landmarkLabel])) : og_get($v_nav, ['subTitle']))], 'children' => og_markup($c_15)])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['flex w-56 flex-col gap-4 px-4 py-6', (og_t(og_eq($v_side, 'end')) ? 'border-r border-border' : 'border-l border-border')])), 'attrs' => og_attrs(['data-slot', 'subnav']), 'children' => (string) $c_16])|noescape}
{/if}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'aside', 'class' => og_s(og_cnv(['flex shrink-0 bg-card', (og_t(og_eq($v_side, 'end')) ? 'flex-row-reverse border-l border-border' : 'border-r border-border')])), 'attrs' => og_attrs(['aria-label', og_coalesce([$v_landmarkLabel, og_get($v_nav, ['label'])]), 'data-mode', $v_mode, 'data-slot', 'sidebar']), 'children' => (string) $c_17])|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 shell-sidebar{#- 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/shell-sidebar.json
The sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read), collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a panel of the current section's links). side puts it at the start or the end.
Props (p): nav, mode, side, brand, landmarkLabel. -#}
{%- set v_nav = og_def(p['nav'], none) -%}
{%- set v_mode = og_def(p['mode'], 'wide') -%}
{%- set v_side = og_def(p['side'], 'start') -%}
{%- set v_brand = og_def(p['brand'], 'show') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set v_named = og_eq(v_mode, 'wide') -%}
{%- set c_17 -%}
{%- set c_9 -%}
{%- if og_t(og_eq(v_brand, 'show')) %}
{%- set c_2 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'layers', 'Size': 24}}) }}
{%- set c_1 -%}
{{ og_text(og_get(v_nav, ['brand'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'bold', 'Class': og_s(('' if og_t(v_named) else 'sr-only'))}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Class': 'shrink-0', 'Attrs': og_attrs(['data-slot', 'brand'])}, 'children': c_2}) }}
{%- endif %}
{%- if og_t(og_gt(og_len(og_get(v_nav, ['links'])), 0)) %}
{%- set c_7 -%}
{%- set c_6 -%}
{%- for v_l in og_l(og_get(v_nav, ['links'])) %}
{%- set c_5 -%}
{%- set c_4 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_l, ['icon'])), 'Size': 16}}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_l, ['name'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': og_s(('' if og_t(v_named) else 'sr-only'))}, 'children': c_3}) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_l, ['href']), 'className': og_cnv([og_cnv(['flex items-center gap-4 rounded py-2 text-sm', ('px-4' if og_t(v_named) else 'justify-center px-2'), ('bg-muted font-medium' if og_t(og_eq(og_get(v_l, ['id']), og_get(v_nav, ['current']))) else '')])]), 'current': og_eq(og_get(v_l, ['id']), og_get(v_nav, ['current'])), 'size': 'sm', 'testid': 'item'}, 'children': og_markup(c_4)}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Attrs': og_attrs(['data-slot', 'links-row'])}, 'children': c_5}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-2 p-0', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('blocks/nav-block.html.j2', {'p': {'label': (og_uniq(og_tpl('{0}, {1}', [og_get(v_nav, ['label']), v_landmarkLabel])) if og_t(v_landmarkLabel) else og_get(v_nav, ['label'])), 'className': og_cnv(['flex-1'])}, 'children': og_markup(c_7)}) }}
{%- endif %}
{%- if og_t(og_eq(v_mode, 'collapsed')) %}
{%- set c_8 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'panel-left', 'Size': 20}}) }}
{%- endset -%}
{{ og_include('compose/button-plain.html.j2', {'p': {'Type': 'button', 'Class': 'inline-flex size-10 items-center justify-center rounded text-muted-foreground', 'Attrs': og_attrs(['aria-label', og_get(v_nav, ['expand']), 'aria-expanded', ('true' if og_t(og_eq(v_mode, 'wide')) else 'false'), 'data-slot', 'toggle'])}, 'children': c_8}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['flex flex-col gap-6 py-4', ('w-64 px-4' if og_t(v_named) else 'w-16 items-center px-2')]))}, 'children': c_9}) }}
{%- if og_t(og_and([og_eq(v_mode, 'twolevel'), og_gt(og_len(og_get(v_nav, ['sub'])), 0)])) %}
{%- set c_16 -%}
{%- set c_10 -%}
{{ og_text(og_get(v_nav, ['subTitle'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold', 'Class': 'px-4'}, 'children': c_10}) }}
{%- set c_15 -%}
{%- set c_14 -%}
{%- for v_s in og_l(og_get(v_nav, ['sub'])) %}
{%- set c_13 -%}
{%- set c_12 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_s, ['icon'])), 'Size': 16}}) }}
{%- set c_11 -%}
{{ og_text(og_get(v_s, ['name'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': og_s(('' if og_t(true) else 'sr-only'))}, 'children': c_11}) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_s, ['href']), 'className': og_cnv([og_cnv(['flex items-center gap-4 rounded py-2 text-sm', ('px-4' if og_t(true) else 'justify-center px-2'), ('bg-muted font-medium' if og_t(og_eq(og_get(v_s, ['id']), og_get(v_nav, ['subCurrent']))) else '')])]), 'current': og_eq(og_get(v_s, ['id']), og_get(v_nav, ['subCurrent'])), 'size': 'sm', 'testid': 'item'}, 'children': og_markup(c_12)}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Attrs': og_attrs(['data-slot', 'sub-row'])}, 'children': c_13}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-2 p-0'}, 'children': c_14}) }}
{%- endset -%}
{{ og_include('blocks/nav-block.html.j2', {'p': {'label': (og_uniq(og_tpl('{0}, {1}', [og_get(v_nav, ['subTitle']), v_landmarkLabel])) if og_t(v_landmarkLabel) else og_get(v_nav, ['subTitle']))}, 'children': og_markup(c_15)}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['flex w-56 flex-col gap-4 px-4 py-6', ('border-r border-border' if og_t(og_eq(v_side, 'end')) else 'border-l border-border')])), 'Attrs': og_attrs(['data-slot', 'subnav'])}, 'children': c_16}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'aside', 'Class': og_s(og_cnv(['flex shrink-0 bg-card', ('flex-row-reverse border-l border-border' if og_t(og_eq(v_side, 'end')) else 'border-r border-border')])), 'Attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, og_get(v_nav, ['label'])]), 'data-mode', v_mode, 'data-slot', 'sidebar'])}, 'children': c_17}) }}
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 sidebar of DashboardShell. Shapes: wide (icon and name), rail (icons only, the names still read), collapsed (the static collapsed state of a wide sidebar, with its expand button), twolevel (a rail beside a panel of the current section's links). side puts it at the start or the end.
| Prop | Type | Default | Description |
|---|---|---|---|
| nav (required) | ShellNav | - | the brand, the links and the texts of the shell |
| mode | "wide" | "rail" | "collapsed" | "twolevel" | "none" | "wide" | the DashboardShell sidebar; the shell draws no sidebar for none |
| side | "start" | "end" | "start" | |
| brand | "show" | "hide" | "show" | |
| 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 |