Store stacked — Navbar block

Free

navbar-store-stacked · for home, catalog, product, cart, checkout, account, landing pages

Store stacked

A long name or many links: the name centred, the links centred in a second row

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-store-stacked

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import NavbarStoreStacked from '@/components/trame/blocks/navbar/navbar-store-stacked.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"
}
</script>

<template>
<NavbarStoreStacked 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
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
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 · 4 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
monobooleandraw the logo with the text colour through a mask, so it follows the theme and the mode (light or dark); needs the file on the same origin
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[], account, account.entries[], account.signOut, cart, cart.checkout, search, quickSearch
  • Reads products, 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

  • 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.
  • 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.
  • Mega menu panel: catalogues of three to six categories: a link opens a wide panel of picture cards.
  • 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.
  • Underline tabs: a portfolio or editorial site: the name left, the links as tabs, the current page underlined, no button.

All 20 navbar blocks