Reorder row — Navbar block

Pro

navbar-reorder-row · for home, catalog, product, cart, checkout, account, landing pages

Reorder row

Grocery and consumables: a slim second row of what the visitor bought before

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-reorder-row

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import NavbarReorderRow from '@/components/trame/blocks/navbar/navbar-reorder-row.vue'

const props = {
name: "Maison Aubrac",
links: [
{
label: "New arrivals",
action: "collection",
record: {
id: "nouveautes"
},
current: true
},
{
label: "Shoes",
action: "collection",
record: {
id: "chaussures"
}
}
],
account: {
action: "account"
},
cart: {
action: "cart",
count: 2
},
search: "search",
reorder: [
{
id: 21,
name: "Whole bean coffee, 2.2 lb",
price: 1890
},
{
id: 22,
name: "Oat milk",
price: 245
}
]
}
</script>

<template>
<NavbarReorderRow 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
reorder*Reorder[]Datawhat the visitor bought before, from their own history
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
Reorder reorder[] · 19 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
compareAtnumberthe price before the merchant’s reduction
currencystringDesignISO 4217, EUR by default
imagestring | nullPicturethe main picture; null or absent: the product has none yet
imagesstring[]Picturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the main picture shows
brandstringWordsthe brand or maker
categorystringWordsthe product’s category, e.g. "Knitwear"
summarystringWordsone short line on the product
badgestringWordsa short tag the merchant set ("New", "Handmade")
ratingnumberthe average of the shop’s own stored reviews
reviewCountnumberhow many stored reviews the rating averages
availablebooleanfalse: sold out; true or absent: can be bought
stocknumberthe real stock, when the merchant shows it
maxQuantitynumberthe most one order may hold of it, as the merchant set it (one per customer, a limited run)
optionsOption[]the product’s options and their values, e.g. sizes
highlightsHighlight[]a few key facts the merchant set, shown on the product’s card
Option reorder[].options[] · 2 props
PropTypeDescription
name*stringWordsthe option’s name, e.g. "Size"
values*string[]Wordsits values, e.g. "S", "M", "L"
Highlight reorder[].highlights[] · 2 props
PropTypeDescription
label*stringWordsthe property ("Material", "Capacity")
value*stringWordsits value, as the merchant states it ("Washed linen", "50 cl")
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 · 5 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
reorderActionstringActionwhere a reorder chip leads (the product page by default)
reorderLabelstringWordsthe reorder row’s title ("Buy again")
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, options.reorderAction
  • Reads products 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 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.
  • 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.
  • Store centered: a shop whose name is its mark: links left, name centred, actions right.
  • Store classic: the default bar: name left, links beside it, actions right.

All 20 navbar blocks