Mega Menu
A top bar whose first item opens a wide panel of link groups, with an optional promo card.
Install
npx ui8kit add mega-menuPulls in: block, box, button-plain, compose, container, grid, group, kit-box, kit-button, kit-text, list, list-item, lucide-icon, media-frame, menu-entry, nav-bar, nav-block, stack, text, utils
Preview
Product
Resources
Company
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 mega-menu<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional
promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed),
cols (2, 3), promo (none, card).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { MegaGroup } from "./mega-menu.types";
import type { NavLink } from "./nav-bar.types";
export type MegaMenuProps = {
label: string;
brand: string;
brandHref?: string;
trigger: string;
links: NavLink[];
groups: MegaGroup[];
promoTitle?: string;
promoText?: string;
panel?: "open" | "closed";
cols?: "2" | "3";
promo?: "none" | "card";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Box from "../compose/Box.svelte";
import ButtonPlain from "../compose/ButtonPlain.svelte";
import Container from "../compose/Container.svelte";
import Grid from "../compose/Grid.svelte";
import Group from "../compose/Group.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import MediaFrame from "../components/media-frame.svelte";
import MenuEntry from "../components/menu-entry.svelte";
import NavBlock from "../components/nav-block.svelte";
import { cn, tpl, uniqLabel } from "../utils";
let {
label,
brand,
brandHref,
trigger,
links,
groups,
promoTitle,
promoText,
panel = "open",
cols = "3",
promo = "none",
landmarkLabel,
}: MegaMenuProps = $props();
</script>
<Block
tag="header"
class="relative border-b border-border bg-background"
aria-label={landmarkLabel}
data-slot="mega-menu"
>
<Container
class={cn("mx-auto w-full max-w-6xl px-4", "flex flex-wrap items-center gap-6 py-4")}
data-slot="container"
>
<MenuEntry href={brandHref} class="text-lg font-medium" testid="brand">
{brand}
</MenuEntry>
<NavBlock label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", label, landmarkLabel)) : label)} class="flex-1">
<Group gap="4" align="center" class="flex-wrap">
<ButtonPlain
type="button"
class="inline-flex items-center gap-2 text-sm font-semibold"
aria-expanded={(((panel as string) === "open") ? "true" : "false")}
data-slot="mega-trigger"
>
{trigger}
<LucideIcon name="chevron-down" size={16} />
</ButtonPlain>
{#each links as l (l.id)}
<MenuEntry href={l.href} class="text-sm" current={(l.id === "")} testid="nav-link">
{l.name}
</MenuEntry>
{/each}
</Group>
</NavBlock>
</Container>
</Block>
{#if ((panel as string) === "open")}
<Box class="border-t border-border bg-card" data-slot="mega-panel">
<Container
class={cn(
"mx-auto w-full max-w-6xl px-4",
"grid gap-8 py-6",
(((promo as string) === "card") ? "md:grid-cols-[1fr_16rem]" : "")
)}
data-slot="container"
>
{#if ((groups?.length ?? 0) > 0)}
<Grid cols={(((cols as string) === "2") ? "1-2" : "1-3")} class="gap-6" data-slot="items">
{#each groups as g (g.id)}
<Stack gap="2" data-slot="item">
<Group gap="2" align="center">
<LucideIcon name={g.icon} size={16} />
<Text size="sm" weight="semibold">
{g.title}
</Text>
</Group>
<List class="m-0 flex list-none flex-col gap-2 p-0">
{#each g.links as item (item.id)}
<ListItem data-slot="links-row">
<MenuEntry href={item.href} class="text-sm text-muted-foreground">
{item.name}
</MenuEntry>
</ListItem>
{/each}
</List>
</Stack>
{/each}
</Grid>
{/if}
{#if ((promo as string) === "card")}
<Stack gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="promo">
<MediaFrame alt={(promoTitle ?? "")} ratio="4/3" />
<Text size="base" weight="semibold">
{promoTitle}
</Text>
<Text size="xs" class="text-muted-foreground">
{promoText}
</Text>
</Stack>
{/if}
</Container>
</Box>
{/if}
// 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 MegaGroup = {
id: string;
title: string;
icon: string;
links: NavLink[];
href?: 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 mega-menu// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional
* promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed),
* cols (2, 3), promo (none, card).
*/
import { type ReactNode } from "react";
import { Block, Box, ButtonPlain, Container, Grid, Group, List, ListItem, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { NavBlock } from "../components/nav-block";
import { cn, tpl, uniqLabel } from "../utils";
import type { MegaGroup } from "./mega-menu.types";
import type { NavLink } from "./nav-bar.types";
export type MegaMenuProps = {
label: string;
brand: string;
brandHref?: string;
trigger: string;
links: NavLink[];
groups: MegaGroup[];
promoTitle?: string;
promoText?: string;
panel?: "open" | "closed";
cols?: "2" | "3";
promo?: "none" | "card";
landmarkLabel?: string;
};
export function MegaMenu({
label,
brand,
brandHref,
trigger,
links,
groups,
promoTitle,
promoText,
panel = "open",
cols = "3",
promo = "none",
landmarkLabel,
}: MegaMenuProps) {
return (
<>
<Block
tag="header"
className="relative border-b border-border bg-background"
aria-label={landmarkLabel}
data-slot="mega-menu"
>
<Container
className={cn("mx-auto w-full max-w-6xl px-4", "flex flex-wrap items-center gap-6 py-4")}
data-slot="container"
>
<MenuEntry href={brandHref} className="text-lg font-medium" testid="brand">
{brand}
</MenuEntry>
<NavBlock label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", label, landmarkLabel)) : label)} className="flex-1">
<Group gap="4" align="center" className="flex-wrap">
<ButtonPlain
type="button"
className="inline-flex items-center gap-2 text-sm font-semibold"
aria-expanded={(((panel as string) === "open") ? "true" : "false")}
data-slot="mega-trigger"
>
{trigger}
<LucideIcon name="chevron-down" size={16} />
</ButtonPlain>
{(links ?? []).map((l) => (
<MenuEntry key={l.id} href={l.href} className="text-sm" current={(l.id === "")} testid="nav-link">
{l.name}
</MenuEntry>
))}
</Group>
</NavBlock>
</Container>
</Block>
{((panel as string) === "open") ? (
<Box className="border-t border-border bg-card" data-slot="mega-panel">
<Container
className={cn(
"mx-auto w-full max-w-6xl px-4",
"grid gap-8 py-6",
(((promo as string) === "card") ? "md:grid-cols-[1fr_16rem]" : "")
)}
data-slot="container"
>
{((groups?.length ?? 0) > 0) ? (
<Grid cols={(((cols as string) === "2") ? "1-2" : "1-3")} className="gap-6" data-slot="items">
{(groups ?? []).map((g) => (
<Stack key={g.id} gap="2" data-slot="item">
<Group gap="2" align="center">
<LucideIcon name={g.icon} size={16} />
<Text size="sm" weight="semibold">
{g.title}
</Text>
</Group>
<List className="m-0 flex list-none flex-col gap-2 p-0">
{(g.links ?? []).map((item) => (
<ListItem key={item.id} data-slot="links-row">
<MenuEntry href={item.href} className="text-sm text-muted-foreground">
{item.name}
</MenuEntry>
</ListItem>
))}
</List>
</Stack>
))}
</Grid>
) : null}
{((promo as string) === "card") ? (
<Stack gap="2" className="rounded bg-card inset-ring inset-ring-border p-4" data-slot="promo">
<MediaFrame alt={(promoTitle ?? "")} ratio="4/3" />
<Text size="base" weight="semibold">
{promoTitle}
</Text>
<Text size="xs" className="text-muted-foreground">
{promoText}
</Text>
</Stack>
) : null}
</Container>
</Box>
) : null}
</>
);
}
// 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 MegaGroup = {
id: string;
title: string;
icon: string;
links: NavLink[];
href?: 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 mega-menu// 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 MegaGroup = {
id: string;
title: string;
icon: string;
links: NavLink[];
href?: 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. -->
<!--
A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional
promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed),
cols (2, 3), promo (none, card).
-->
<script lang="ts">
import type { MegaGroup } from "./mega-menu.types";
import type { NavLink } from "./nav-bar.types";
export type MegaMenuProps = {
label: string;
brand: string;
brandHref?: string;
trigger: string;
links: NavLink[];
groups: MegaGroup[];
promoTitle?: string;
promoText?: string;
panel?: "open" | "closed";
cols?: "2" | "3";
promo?: "none" | "card";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Block from "../compose/Block.vue";
import Box from "../compose/Box.vue";
import ButtonPlain from "../compose/ButtonPlain.vue";
import Container from "../compose/Container.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import MediaFrame from "../components/media-frame.vue";
import MenuEntry from "../components/menu-entry.vue";
import NavBlock from "../components/nav-block.vue";
import { cn, tpl, uniqLabel } from "../utils";
const {
label,
brand,
brandHref,
trigger,
links,
groups,
promoTitle,
promoText,
panel = "open",
cols = "3",
promo = "none",
landmarkLabel,
} = defineProps<MegaMenuProps>();
</script>
<template>
<Block
tag="header"
class="relative border-b border-border bg-background"
:aria-label="landmarkLabel"
data-slot="mega-menu"
>
<Container
:class="cn('mx-auto w-full max-w-6xl px-4', 'flex flex-wrap items-center gap-6 py-4')"
data-slot="container"
>
<MenuEntry :href="brandHref" class="text-lg font-medium" testid="brand">
{{ brand }}
</MenuEntry>
<NavBlock :label="(landmarkLabel ? uniqLabel(tpl('{0}, {1}', label, landmarkLabel)) : label)" class="flex-1">
<Group gap="4" align="center" class="flex-wrap">
<ButtonPlain
type="button"
class="inline-flex items-center gap-2 text-sm font-semibold"
:aria-expanded="(((panel as string) === 'open') ? 'true' : 'false')"
data-slot="mega-trigger"
>
{{ trigger }}
<LucideIcon name="chevron-down" :size="16" />
</ButtonPlain>
<MenuEntry
v-for="l in links"
:key="l.id"
:href="l.href"
class="text-sm"
:current="(l.id === '')"
testid="nav-link"
>
{{ l.name }}
</MenuEntry>
</Group>
</NavBlock>
</Container>
</Block>
<Box v-if="((panel as string) === 'open')" class="border-t border-border bg-card" data-slot="mega-panel">
<Container
:class="cn(
'mx-auto w-full max-w-6xl px-4',
'grid gap-8 py-6',
(((promo as string) === 'card') ? 'md:grid-cols-[1fr_16rem]' : '')
)"
data-slot="container"
>
<Grid
v-if="((groups?.length ?? 0) > 0)"
:cols="(((cols as string) === '2') ? '1-2' : '1-3')"
class="gap-6"
data-slot="items"
>
<Stack v-for="g in groups" :key="g.id" gap="2" data-slot="item">
<Group gap="2" align="center">
<LucideIcon :name="g.icon" :size="16" />
<Text size="sm" weight="semibold">
{{ g.title }}
</Text>
</Group>
<List class="m-0 flex list-none flex-col gap-2 p-0">
<ListItem v-for="item in g.links" :key="item.id" data-slot="links-row">
<MenuEntry :href="item.href" class="text-sm text-muted-foreground">
{{ item.name }}
</MenuEntry>
</ListItem>
</List>
</Stack>
</Grid>
<Stack
v-if="((promo as string) === 'card')"
gap="2"
class="rounded bg-card inset-ring inset-ring-border p-4"
data-slot="promo"
>
<MediaFrame :alt="(promoTitle ?? '')" ratio="4/3" />
<Text size="base" weight="semibold">
{{ promoTitle }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ promoText }}
</Text>
</Stack>
</Container>
</Box>
</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 mega-menu// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional
* promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed),
* cols (2, 3), promo (none, card).
*/
import { For, type JSX } from "solid-js";
import { Block, Box, ButtonPlain, Container, Grid, Group, List, ListItem, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { MenuEntry } from "../components/menu-entry";
import { NavBlock } from "../components/nav-block";
import { cn, tpl, uniqLabel } from "../utils";
import type { MegaGroup } from "./mega-menu.types";
import type { NavLink } from "./nav-bar.types";
export type MegaMenuProps = {
label: string;
brand: string;
brandHref?: string;
trigger: string;
links: NavLink[];
groups: MegaGroup[];
promoTitle?: string;
promoText?: string;
panel?: "open" | "closed";
cols?: "2" | "3";
promo?: "none" | "card";
landmarkLabel?: string;
};
export function MegaMenu({
label,
brand,
brandHref,
trigger,
links,
groups,
promoTitle,
promoText,
panel = "open",
cols = "3",
promo = "none",
landmarkLabel,
}: MegaMenuProps) {
return (
<>
<Block
tag="header"
class="relative border-b border-border bg-background"
aria-label={landmarkLabel}
data-slot="mega-menu"
>
<Container
class={cn("mx-auto w-full max-w-6xl px-4", "flex flex-wrap items-center gap-6 py-4")}
data-slot="container"
>
<MenuEntry href={brandHref} class="text-lg font-medium" testid="brand">
{brand}
</MenuEntry>
<NavBlock label={(landmarkLabel ? uniqLabel(tpl("{0}, {1}", label, landmarkLabel)) : label)} class="flex-1">
<Group gap="4" align="center" class="flex-wrap">
<ButtonPlain
type="button"
class="inline-flex items-center gap-2 text-sm font-semibold"
aria-expanded={(((panel as string) === "open") ? "true" : "false")}
data-slot="mega-trigger"
>
{trigger}
<LucideIcon name="chevron-down" size={16} />
</ButtonPlain>
<For each={links ?? []}>{(l) => (
<MenuEntry href={l.href} class="text-sm" current={(l.id === "")} testid="nav-link">
{l.name}
</MenuEntry>
)}</For>
</Group>
</NavBlock>
</Container>
</Block>
{((panel as string) === "open") ? (
<Box class="border-t border-border bg-card" data-slot="mega-panel">
<Container
class={cn(
"mx-auto w-full max-w-6xl px-4",
"grid gap-8 py-6",
(((promo as string) === "card") ? "md:grid-cols-[1fr_16rem]" : "")
)}
data-slot="container"
>
{((groups?.length ?? 0) > 0) ? (
<Grid cols={(((cols as string) === "2") ? "1-2" : "1-3")} class="gap-6" data-slot="items">
<For each={groups ?? []}>{(g) => (
<Stack gap="2" data-slot="item">
<Group gap="2" align="center">
<LucideIcon name={g.icon} size={16} />
<Text size="sm" weight="semibold">
{g.title}
</Text>
</Group>
<List class="m-0 flex list-none flex-col gap-2 p-0">
<For each={g.links ?? []}>{(item) => (
<ListItem data-slot="links-row">
<MenuEntry href={item.href} class="text-sm text-muted-foreground">
{item.name}
</MenuEntry>
</ListItem>
)}</For>
</List>
</Stack>
)}</For>
</Grid>
) : null}
{((promo as string) === "card") ? (
<Stack gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="promo">
<MediaFrame alt={(promoTitle ?? "")} ratio="4/3" />
<Text size="base" weight="semibold">
{promoTitle}
</Text>
<Text size="xs" class="text-muted-foreground">
{promoText}
</Text>
</Stack>
) : null}
</Container>
</Box>
) : null}
</>
);
}
// 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 MegaGroup = {
id: string;
title: string;
icon: string;
links: NavLink[];
href?: 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 mega-menu// 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/mega-menu.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"
)
// MegaMenuProps are the props of MegaMenu; the values are the JSON shapes of the TypeScript props.
type MegaMenuProps struct {
Label any `json:"label"`
Brand any `json:"brand"`
BrandHref any `json:"brandHref"`
Trigger any `json:"trigger"`
Links any `json:"links"`
Groups any `json:"groups"`
PromoTitle any `json:"promoTitle"`
PromoText any `json:"promoText"`
Panel any `json:"panel"`
Cols any `json:"cols"`
Promo any `json:"promo"`
LandmarkLabel any `json:"landmarkLabel"`
}
// A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed), cols (2, 3), promo (none, card).
templ MegaMenu(p MegaMenuProps) {
{{ vLabel := p.Label }}
{{ vBrand := p.Brand }}
{{ vBrandHref := p.BrandHref }}
{{ vTrigger := p.Trigger }}
{{ vLinks := p.Links }}
{{ vGroups := p.Groups }}
{{ vPromoTitle := p.PromoTitle }}
{{ vPromoText := p.PromoText }}
{{ vPanel := uiutils.Def(p.Panel, "open") }}
{{ vCols := uiutils.Def(p.Cols, "3") }}
{{ vPromo := uiutils.Def(p.Promo, "none") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "header", Class: "relative border-b border-border bg-background", Attrs: uiutils.Attrs("aria-label", vLandmarkLabel, "data-slot", "mega-menu")}}) {
@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full max-w-6xl px-4", "flex flex-wrap items-center gap-6 py-4")), Attrs: uiutils.Attrs("data-slot", "container")}}) {
@MenuEntry(MenuEntryProps{Href: vBrandHref, Class: uiutils.Cnv("text-lg font-medium"), Testid: "brand"}) {
{ uiutils.Text(vBrand) }
}
@NavBlock(NavBlockProps{Label: uiutils.Cond(uiutils.T(vLandmarkLabel), uiutils.Uniq(uiutils.Tpl("{0}, {1}", vLabel, vLandmarkLabel)), vLabel), Class: uiutils.Cnv("flex-1")}) {
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Class: "flex-wrap"}}) {
@compose.ButtonPlain(compose.ButtonPlainProps{ButtonProps: button.ButtonProps{Type: "button", Class: "inline-flex items-center gap-2 text-sm font-semibold", Attrs: uiutils.Attrs("aria-expanded", uiutils.Cond(uiutils.T(uiutils.Eq(vPanel, "open")), "true", "false"), "data-slot", "mega-trigger")}}) {
{ uiutils.Text(vTrigger) }
@icons.LucideIcon(icons.LucideIconProps{Name: "chevron-down", Size: 16})
}
for _, vL := range uiutils.L(vLinks) {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vL, "href"), Class: uiutils.Cnv("text-sm"), Current: uiutils.Eq(uiutils.Get(vL, "id"), ""), Testid: "nav-link"}) {
{ uiutils.Text(uiutils.Get(vL, "name")) }
}
}
}
}
}
}
if uiutils.Eq(vPanel, "open") {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "border-t border-border bg-card", Attrs: uiutils.Attrs("data-slot", "mega-panel")}}) {
@compose.Container(compose.ContainerProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full max-w-6xl px-4", "grid gap-8 py-6", uiutils.Cond(uiutils.T(uiutils.Eq(vPromo, "card")), "md:grid-cols-[1fr_16rem]", ""))), Attrs: uiutils.Attrs("data-slot", "container")}}) {
if uiutils.Gt(uiutils.Len(vGroups), float64(0)) {
@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vCols, "2")), "1-2", "1-3")), BoxProps: box.BoxProps{Class: "gap-6", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vG := range uiutils.L(vGroups) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vG, "icon")), Size: 16})
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vG, "title")) }
}
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-2 p-0"}}) {
for _, vItem := range uiutils.L(uiutils.Get(vG, "links")) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "links-row")}}) {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vItem, "href"), Class: uiutils.Cnv("text-sm text-muted-foreground")}) {
{ uiutils.Text(uiutils.Get(vItem, "name")) }
}
}
}
}
}
}
}
}
if uiutils.Eq(vPromo, "card") {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-4", Attrs: uiutils.Attrs("data-slot", "promo")}}) {
@MediaFrame(MediaFrameProps{Alt: uiutils.Coalesce(vPromoTitle, ""), Ratio: "4/3"})
@compose.Text(compose.TextProps{Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(vPromoTitle) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(vPromoText) }
}
}
}
}
}
}
}
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 mega-menu{#- 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/mega-menu.json
A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed), cols (2, 3), promo (none, card).
Props (p): label, brand, brandHref, trigger, links, groups, promoTitle, promoText, panel, cols, promo, landmarkLabel. -#}
{%- set v_label = (p.label ?? null) -%}
{%- set v_brand = (p.brand ?? null) -%}
{%- set v_brandHref = (p.brandHref ?? null) -%}
{%- set v_trigger = (p.trigger ?? null) -%}
{%- set v_links = (p.links ?? null) -%}
{%- set v_groups = (p.groups ?? null) -%}
{%- set v_promoTitle = (p.promoTitle ?? null) -%}
{%- set v_promoText = (p.promoText ?? null) -%}
{%- set v_panel = (p.panel ?? 'open') -%}
{%- set v_cols = (p.cols ?? '3') -%}
{%- set v_promo = (p.promo ?? 'none') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_7 -%}
{%- set c_6 -%}
{%- set c_1 -%}
{{ og_text(v_brand) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': v_brandHref, 'className': og_cnv(['text-lg font-medium']), 'testid': 'brand'}, 'children': og_markup(c_1)}, with_context = false) }}
{%- set c_5 -%}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(v_trigger) }}
{{ include('icons/LucideIcon.html.twig', {'name': 'chevron-down', 'size': 16}, with_context = false) }}
{%- endset -%}
{{ include('compose/ButtonPlain.html.twig', {'type': 'button', 'class': 'inline-flex items-center gap-2 text-sm font-semibold', 'attrs': og_attrs(['aria-expanded', (og_t(og_eq(v_panel, 'open')) ? 'true' : 'false'), 'data-slot', 'mega-trigger']), 'children': c_2}, with_context = false) }}
{%- for v_l in og_l(v_links) %}
{%- set c_3 -%}
{{ og_text(og_get(v_l, ['name'])) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_l, ['href']), 'className': og_cnv(['text-sm']), 'current': og_eq(og_get(v_l, ['id']), ''), 'testid': 'nav-link'}, 'children': og_markup(c_3)}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'class': 'flex-wrap', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('blocks/nav-block.html.twig', {'p': {'label': (og_t(v_landmarkLabel) ? og_uniq(og_tpl('{0}, {1}', [v_label, v_landmarkLabel])) : v_label), 'className': og_cnv(['flex-1'])}, 'children': og_markup(c_5)}, with_context = false) }}
{%- endset -%}
{{ include('compose/Container.html.twig', {'class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'flex flex-wrap items-center gap-6 py-4'])), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'header', 'class': 'relative border-b border-border bg-background', 'attrs': og_attrs(['aria-label', v_landmarkLabel, 'data-slot', 'mega-menu']), 'children': c_7}, with_context = false) }}
{%- if og_t(og_eq(v_panel, 'open')) %}
{%- set c_19 -%}
{%- set c_18 -%}
{%- if og_t(og_gt(og_len(v_groups), 0)) %}
{%- set c_14 -%}
{%- for v_g in og_l(v_groups) %}
{%- set c_13 -%}
{%- set c_9 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_g, ['icon'])), 'size': 16}, with_context = false) }}
{%- set c_8 -%}
{{ og_text(og_get(v_g, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_9}, with_context = false) }}
{%- set c_12 -%}
{%- for v_item in og_l(og_get(v_g, ['links'])) %}
{%- set c_11 -%}
{%- set c_10 -%}
{{ og_text(og_get(v_item, ['name'])) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_item, ['href']), 'className': og_cnv(['text-sm text-muted-foreground'])}, 'children': og_markup(c_10)}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'attrs': og_attrs(['data-slot', 'links-row']), 'children': c_11}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-2 p-0', 'children': c_12}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_13}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_cols, '2')) ? '1-2' : '1-3')), 'class': 'gap-6', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_14}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(v_promo, 'card')) %}
{%- set c_17 -%}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_coalesce([v_promoTitle, '']), 'ratio': '4/3'}}, with_context = false) }}
{%- set c_15 -%}
{{ og_text(v_promoTitle) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'semibold', 'children': c_15}, with_context = false) }}
{%- set c_16 -%}
{{ og_text(v_promoText) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_16}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs': og_attrs(['data-slot', 'promo']), 'children': c_17}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Container.html.twig', {'class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'grid gap-8 py-6', (og_t(og_eq(v_promo, 'card')) ? 'md:grid-cols-[1fr_16rem]' : '')])), 'attrs': og_attrs(['data-slot', 'container']), 'children': c_18}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'border-t border-border bg-card', 'attrs': og_attrs(['data-slot', 'mega-panel']), 'children': c_19}, with_context = false) }}
{%- endif %}
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 mega-menu{* 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/mega-menu.json
A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed), cols (2, 3), promo (none, card).
Props (p): label, brand, brandHref, trigger, links, groups, promoTitle, promoText, panel, cols, promo, landmarkLabel. *}
{var $v_label = ($p['label'] ?? null)}
{var $v_brand = ($p['brand'] ?? null)}
{var $v_brandHref = ($p['brandHref'] ?? null)}
{var $v_trigger = ($p['trigger'] ?? null)}
{var $v_links = ($p['links'] ?? null)}
{var $v_groups = ($p['groups'] ?? null)}
{var $v_promoTitle = ($p['promoTitle'] ?? null)}
{var $v_promoText = ($p['promoText'] ?? null)}
{var $v_panel = ($p['panel'] ?? 'open')}
{var $v_cols = ($p['cols'] ?? '3')}
{var $v_promo = ($p['promo'] ?? 'none')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_7}
{capture $c_6}
{capture $c_1}
{=og_text($v_brand)}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => $v_brandHref, 'className' => og_cnv(['text-lg font-medium']), 'testid' => 'brand'], 'children' => og_markup($c_1)])|noescape}
{capture $c_5}
{capture $c_4}
{capture $c_2}
{=og_text($v_trigger)}
{=og_include('icons/LucideIcon.latte', ['name' => 'chevron-down', 'size' => 16])|noescape}
{/capture}
{=og_include('compose/ButtonPlain.latte', ['type' => 'button', 'class' => 'inline-flex items-center gap-2 text-sm font-semibold', 'attrs' => og_attrs(['aria-expanded', (og_t(og_eq($v_panel, 'open')) ? 'true' : 'false'), 'data-slot', 'mega-trigger']), 'children' => (string) $c_2])|noescape}
{foreach og_l($v_links) as $v_l}
{capture $c_3}
{=og_text(og_get($v_l, ['name']))}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_l, ['href']), 'className' => og_cnv(['text-sm']), 'current' => og_eq(og_get($v_l, ['id']), ''), 'testid' => 'nav-link'], 'children' => og_markup($c_3)])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'class' => 'flex-wrap', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('blocks/nav-block.latte', ['p' => ['label' => (og_t($v_landmarkLabel) ? og_uniq(og_tpl('{0}, {1}', [$v_label, $v_landmarkLabel])) : $v_label), 'className' => og_cnv(['flex-1'])], 'children' => og_markup($c_5)])|noescape}
{/capture}
{=og_include('compose/Container.latte', ['class' => og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'flex flex-wrap items-center gap-6 py-4'])), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'header', 'class' => 'relative border-b border-border bg-background', 'attrs' => og_attrs(['aria-label', $v_landmarkLabel, 'data-slot', 'mega-menu']), 'children' => (string) $c_7])|noescape}
{if og_t(og_eq($v_panel, 'open'))}
{capture $c_19}
{capture $c_18}
{if og_t(og_gt(og_len($v_groups), 0))}
{capture $c_14}
{foreach og_l($v_groups) as $v_g}
{capture $c_13}
{capture $c_9}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_g, ['icon'])), 'size' => 16])|noescape}
{capture $c_8}
{=og_text(og_get($v_g, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_9])|noescape}
{capture $c_12}
{foreach og_l(og_get($v_g, ['links'])) as $v_item}
{capture $c_11}
{capture $c_10}
{=og_text(og_get($v_item, ['name']))}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_item, ['href']), 'className' => og_cnv(['text-sm text-muted-foreground'])], 'children' => og_markup($c_10)])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['attrs' => og_attrs(['data-slot', 'links-row']), 'children' => (string) $c_11])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-2 p-0', 'children' => (string) $c_12])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_13])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_cols, '2')) ? '1-2' : '1-3')), 'class' => 'gap-6', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_14])|noescape}
{/if}
{if og_t(og_eq($v_promo, 'card'))}
{capture $c_17}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_coalesce([$v_promoTitle, '']), 'ratio' => '4/3']])|noescape}
{capture $c_15}
{=og_text($v_promoTitle)}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_15])|noescape}
{capture $c_16}
{=og_text($v_promoText)}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_16])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs' => og_attrs(['data-slot', 'promo']), 'children' => (string) $c_17])|noescape}
{/if}
{/capture}
{=og_include('compose/Container.latte', ['class' => og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'grid gap-8 py-6', (og_t(og_eq($v_promo, 'card')) ? 'md:grid-cols-[1fr_16rem]' : '')])), 'attrs' => og_attrs(['data-slot', 'container']), 'children' => (string) $c_18])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'border-t border-border bg-card', 'attrs' => og_attrs(['data-slot', 'mega-panel']), 'children' => (string) $c_19])|noescape}
{/if}
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 mega-menu{#- 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/mega-menu.json
A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed), cols (2, 3), promo (none, card).
Props (p): label, brand, brandHref, trigger, links, groups, promoTitle, promoText, panel, cols, promo, landmarkLabel. -#}
{%- set v_label = og_def(p['label'], none) -%}
{%- set v_brand = og_def(p['brand'], none) -%}
{%- set v_brandHref = og_def(p['brandHref'], none) -%}
{%- set v_trigger = og_def(p['trigger'], none) -%}
{%- set v_links = og_def(p['links'], none) -%}
{%- set v_groups = og_def(p['groups'], none) -%}
{%- set v_promoTitle = og_def(p['promoTitle'], none) -%}
{%- set v_promoText = og_def(p['promoText'], none) -%}
{%- set v_panel = og_def(p['panel'], 'open') -%}
{%- set v_cols = og_def(p['cols'], '3') -%}
{%- set v_promo = og_def(p['promo'], 'none') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_7 -%}
{%- set c_6 -%}
{%- set c_1 -%}
{{ og_text(v_brand) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': v_brandHref, 'className': og_cnv(['text-lg font-medium']), 'testid': 'brand'}, 'children': og_markup(c_1)}) }}
{%- set c_5 -%}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(v_trigger) }}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'chevron-down', 'Size': 16}}) }}
{%- endset -%}
{{ og_include('compose/button-plain.html.j2', {'p': {'Type': 'button', 'Class': 'inline-flex items-center gap-2 text-sm font-semibold', 'Attrs': og_attrs(['aria-expanded', ('true' if og_t(og_eq(v_panel, 'open')) else 'false'), 'data-slot', 'mega-trigger'])}, 'children': c_2}) }}
{%- for v_l in og_l(v_links) %}
{%- set c_3 -%}
{{ og_text(og_get(v_l, ['name'])) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_l, ['href']), 'className': og_cnv(['text-sm']), 'current': og_eq(og_get(v_l, ['id']), ''), 'testid': 'nav-link'}, 'children': og_markup(c_3)}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Class': 'flex-wrap'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('blocks/nav-block.html.j2', {'p': {'label': (og_uniq(og_tpl('{0}, {1}', [v_label, v_landmarkLabel])) if og_t(v_landmarkLabel) else v_label), 'className': og_cnv(['flex-1'])}, 'children': og_markup(c_5)}) }}
{%- endset -%}
{{ og_include('compose/container.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'flex flex-wrap items-center gap-6 py-4'])), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'header', 'Class': 'relative border-b border-border bg-background', 'Attrs': og_attrs(['aria-label', v_landmarkLabel, 'data-slot', 'mega-menu'])}, 'children': c_7}) }}
{%- if og_t(og_eq(v_panel, 'open')) %}
{%- set c_19 -%}
{%- set c_18 -%}
{%- if og_t(og_gt(og_len(v_groups), 0)) %}
{%- set c_14 -%}
{%- for v_g in og_l(v_groups) %}
{%- set c_13 -%}
{%- set c_9 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_g, ['icon'])), 'Size': 16}}) }}
{%- set c_8 -%}
{{ og_text(og_get(v_g, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_9}) }}
{%- set c_12 -%}
{%- for v_item in og_l(og_get(v_g, ['links'])) %}
{%- set c_11 -%}
{%- set c_10 -%}
{{ og_text(og_get(v_item, ['name'])) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_item, ['href']), 'className': og_cnv(['text-sm text-muted-foreground'])}, 'children': og_markup(c_10)}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Attrs': og_attrs(['data-slot', 'links-row'])}, 'children': c_11}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-2 p-0'}, 'children': c_12}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_13}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1-2' if og_t(og_eq(v_cols, '2')) else '1-3')), 'Class': 'gap-6', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_14}) }}
{%- endif %}
{%- if og_t(og_eq(v_promo, 'card')) %}
{%- set c_17 -%}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_coalesce([v_promoTitle, '']), 'ratio': '4/3'}}) }}
{%- set c_15 -%}
{{ og_text(v_promoTitle) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'semibold'}, 'children': c_15}) }}
{%- set c_16 -%}
{{ og_text(v_promoText) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_16}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'rounded bg-card inset-ring inset-ring-border p-4', 'Attrs': og_attrs(['data-slot', 'promo'])}, 'children': c_17}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/container.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto w-full max-w-6xl px-4', 'grid gap-8 py-6', ('md:grid-cols-[1fr_16rem]' if og_t(og_eq(v_promo, 'card')) else '')])), 'Attrs': og_attrs(['data-slot', 'container'])}, 'children': c_18}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'border-t border-border bg-card', 'Attrs': og_attrs(['data-slot', 'mega-panel'])}, 'children': c_19}) }}
{%- endif %}
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.
A top bar whose first item opens a wide panel of link groups, each with an icon and a list, and an optional promo card. The page keeps `open`; opening on hover or click is a port contract. Axes: panel (open, closed), cols (2, 3), promo (none, card).
| Prop | Type | Default | Description |
|---|---|---|---|
| label (required) | string | - | |
| brand (required) | string | - | |
| brandHref | string | - | the address of the home page; none: the brand is text |
| trigger (required) | string | - | text of the item that opens the panel |
| links (required) | NavLink[] | - | the other items of the bar |
| groups (required) | MegaGroup[] | - | |
| promoTitle | string | - | |
| promoText | string | - | |
| panel | "open" | "closed" | "open" | |
| cols | "2" | "3" | "3" | |
| promo | "none" | "card" | "none" | |
| 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 |