Mega menu index panel — Navbar block

Pro

navbar-mega-menu-index-panel · for home, catalog, product, cart, checkout, account, landing pages

Mega menu index panel

A deep catalogue, or a brand that wants its name centred: the brand and shortcuts above, the links on a ruled row below, and a link opens an index of every entry in words beside one or two of them as large pictures

Documentation

Installation

One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).

pnpm dlx shadcn-vue@latest add @trame/navbar-mega-menu-index-panel

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import NavbarMegaMenuIndexPanel from '@/components/trame/blocks/navbar/navbar-mega-menu-index-panel.vue'

const props = {
name: "Maison Aubrac",
links: [
{
label: "Shoes",
action: "collection",
record: {
id: "chaussures"
},
children: [
{
label: "Trail",
action: "collection",
record: {
id: "trail"
},
description: "For trails and mud"
},
{
label: "Road",
action: "collection",
record: {
id: "route"
},
description: "Cushioned and lightweight"
}
]
},
{
label: "Clothing",
action: "collection",
record: {
id: "vetements"
},
children: [
{
label: "Jackets",
action: "collection",
record: {
id: "vestes"
}
},
{
label: "Tights",
action: "collection",
record: {
id: "collants"
}
}
]
}
],
account: {
action: "account"
},
cart: {
action: "cart",
count: 2
},
search: "search",
panels: [
{
title: "Shoes",
items: [
{
title: "Trail",
text: "Grip and protection for the trails.",
image: "https://images.unsplash.com/photo-1744402983265-def4533fcfee?w=1600&q=80",
count: 24,
action: "collection",
record: {
id: "trail"
}
},
{
title: "Road",
text: "Cushioned and lightweight, from 5K to marathon.",
image: "https://images.unsplash.com/photo-1575987116913-e96e7d490b8a?w=1600&q=80",
count: 18,
action: "collection",
record: {
id: "route"
}
}
],
all: {
label: "See all shoes",
action: "collection",
record: {
id: "chaussures"
}
}
}
]
}
</script>

<template>
<NavbarMegaMenuIndexPanel v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
name*stringWordsthe shop’s name, shown when there is no logo
logostringPicturea picture: a root-relative path (/media/…) or an absolute URL
links*Link[]the main entries, in order; an entry with children opens a list
panels*Panel[]the menu panels a top link opens
accountAccountthe account button and the signed-in customer’s name
cartCartthe cart button: where it leads and how many items it holds
searchstringActionthe search page
quickSearchstringActiona query the host answers as the visitor types (ctx.query(action, { q, limit })): an array of { label, action?, record?, url?, image?, meta? }, each a link to its url or to ctx.href(action, record); without a host that answers queries the search stays the plain link to the search page
announcementstringWordsa line above the bar, as the merchant wrote it
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Link links[] · 7 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
childrenChildren[]the entries under this link
currentbooleanthe page the visitor is on
highlightbooleanan entry the merchant stresses ("Sale")
Children links[].children[] · 5 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
descriptionstringWordsone line under the entry
Panel panels[] · 3 props
PropTypeDescription
title*stringWordsthe label of the link this panel opens (the same words as the link)
items*Item[]the panel’s items, in order
allAllthe all link: its words and where it leads
Item panels[].items[] · 6 props
PropTypeDescription
title*stringWordsthe item’s title
textstringWordsone line
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
countnumberDatahow many products it holds
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
All panels[].all · 4 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
Account account · 6 props
PropTypeDescription
action*stringActionthe account page
namestringWordsthe signed-in customer’s name
signedInbooleanthe visitor is signed in: the entry shows their initials and says so; false invites to sign in
creditnumberDatastore credit in cents
entriesEntry[]the account’s entries, in order
signOutSignOutthe sign out link: its words and where it leads
Entry account.entries[] · 5 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
statusstringDataa live one-line status ("1 parcel on its way")
SignOut account.signOut · 4 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
Cart cart · 6 props
PropTypeDescription
action*stringActionthe cart page
count*numberDataitems in the cart
subtotalnumberDatacents
linesLine[]Datathe cart’s lines, for a preview
freeShippingThresholdnumberDatacents the merchant sets for free shipping
checkoutstringActiona named action of the page
Line cart.lines[] · 8 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
product*Productthe product on the line
variantstringWordsthe chosen options, written out ("Navy · 42")
unitPrice*numberan amount in cents
compareAtnumberan amount in cents
quantity*numberhow many, at least 1
maxQuantitynumberthe most the line may hold
notestringWordsa line note: a gift, a delivery delay
Product cart.lines[].product · 4 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
imagestring | nullPicturethe main picture; null or absent: the product has none yet
altstringWordswhat the main picture shows
Options options · 3 props
PropTypeDescription
stickyboolean | 'always' | 'smart' | 'none'"always" (or true) keeps the bar on screen, "smart" hides it while one scrolls down and brings it back on the way up, "none" (or false, the default) lets it scroll away
borderbooleanfalse: no line under the header
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa band of the page that redefines the theme surfaces inside it
What it asks your app for

The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
querya live read: a quick search, « see more »
canwhether the page has this action
moneyformats a price, given in cents
asseta picture’s address as your app serves it
Linkyour router’s link component
navigateyour router’s navigation, for links the block follows itself
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour word for an interface key, or undefined to keep the block’s own

The words it says itself, in English and French; label(key) replaces any of them:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo many attempts, try again in a moment.Trop de tentatives, réessayez dans un moment.

Features

  • Every word in the server HTML
  • Same markup in Vue and React
  • Theme tokens only: every theme, light and dark
  • Shows what you give it, invents nothing
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: links[], links[].children[], panels[].items[], panels[].all, account, account.entries[], account.signOut, cart, cart.checkout, search, quickSearch
  • Reads categories from your app

A navbar section, for home, catalog, product, cart, checkout, account, landing pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.

More navbar blocks

  • Checkout focused: the pages where one pays: no links to wander off, a way back to the cart, the name and the merchant’s own words on paying.
  • Classic: a marketing site: the name left, the links centred, the action right.
  • Floating overlay: a site whose page opens on a full-width photo (commerce.HeroImage "overlay", commerce.HeroSlider "fullbleed", landing.HeroSplit "backdrop") and whose bar needs no cart, account or search: a dark inset pill floating over that hero, the name, the links and one action; not for a shop (use shell.StoreHeader), not for an app (use shell.AppShell or shell.CompactShell), not over a page that starts with text or a light band.
  • Floating pill: a landing page or a launch: a rounded bar that floats over the page with one action at its end.
  • Menu overlay: a portfolio, a studio or a brand site with few pages and a strong identity: an almost empty bar whose "Menu" opens a full-screen panel of very large links.
  • Reorder row: grocery and consumables: a slim second row of what the visitor bought before.
  • Spread grid: an editorial or design-led site with 4 or 5 links: a Swiss-grid bar cut into equal columns, the name in the first, one link per column, the action in the last.
  • Store category strip: fashion and home: the name centred, then a strip of category links with the current one underlined.

All 20 navbar blocks