Store utility — Navbar block
Freenavbar-store-utility · for home, catalog, product, cart, checkout, account, landing pages
Store utility
A large catalogue: the name, a search field and the actions, then the links in a bar under them
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-utilityUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import NavbarStoreUtility from '@/components/trame/blocks/navbar/navbar-store-utility.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>
<NavbarStoreUtility v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| name* | string | Wordsthe shop’s name, shown when there is no logo |
| logo | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| links* | Link[] | the main entries, in order; an entry with children opens a list |
| account | Account | the account button and the signed-in customer’s name |
| cart | Cart | the cart button: where it leads and how many items it holds |
| search | string | Actionthe search page |
| quickSearch | string | Actiona 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 |
| announcement | string | Wordsa line above the bar, as the merchant wrote it |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Link links[] · 7 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
| children | Children[] | the entries under this link |
| current | boolean | the page the visitor is on |
| highlight | boolean | an entry the merchant stresses ("Sale") |
Children links[].children[] · 5 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
| description | string | Wordsone line under the entry |
Account account · 6 props
| Prop | Type | Description |
|---|---|---|
| action* | string | Actionthe account page |
| name | string | Wordsthe signed-in customer’s name |
| signedIn | boolean | the visitor is signed in: the entry shows their initials and says so; false invites to sign in |
| credit | number | Datastore credit in cents |
| entries | Entry[] | the account’s entries, in order |
| signOut | SignOut | the sign out link: its words and where it leads |
Entry account.entries[] · 5 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
| status | string | Dataa live one-line status ("1 parcel on its way") |
SignOut account.signOut · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
Cart cart · 6 props
| Prop | Type | Description |
|---|---|---|
| action* | string | Actionthe cart page |
| count* | number | Dataitems in the cart |
| subtotal | number | Datacents |
| lines | Line[] | Datathe cart’s lines, for a preview |
| freeShippingThreshold | number | Datacents the merchant sets for free shipping |
| checkout | string | Actiona named action of the page |
Line cart.lines[] · 8 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| product* | Product | the product on the line |
| variant | string | Wordsthe chosen options, written out ("Navy · 42") |
| unitPrice* | number | an amount in cents |
| compareAt | number | an amount in cents |
| quantity* | number | how many, at least 1 |
| maxQuantity | number | the most the line may hold |
| note | string | Wordsa line note: a gift, a delivery delay |
Product cart.lines[].product · 4 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| sticky | boolean | '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 |
| border | boolean | false: no line under the header |
| mono | boolean | draw 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' | string | a 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).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| query | a live read: a quick search, « see more » |
| can | whether the page has this action |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| navigate | your router’s navigation, for links the block follows itself |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your 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:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too 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,categoriesfrom 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.