Search card — Page heading block

Pro

page-heading-search-card · for catalog, app, account, landing pages

Search card

Finder pages: a centred title above a card holding a search field and up to two selects

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/page-heading-search-card

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import PageHeadingSearchCard from '@/components/trame/blocks/page-heading/page-heading-search-card.vue'

const props = {
title: "Find a store",
lead: "Enter a city or ZIP code.",
search: {
action: "stores",
placeholder: "City or ZIP code",
button: "Search",
selects: [
{
name: "service",
label: "Service",
options: [
{
label: "In-store pickup",
value: "pickup"
},
{
label: "Repairs",
value: "repair"
}
]
},
{
name: "radius",
label: "Radius",
options: [
{
label: "6 miles",
value: "10"
},
{
label: "30 miles",
value: "50"
}
]
}
]
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe page’s title
leadstringWordsone or two sentences under the title
breadcrumbBreadcrumb[]the path to this page, each step a link
metastring[]Wordsa fact about the page: a date, a count, an owner
actionsAction[]the buttons beside the heading
search*Searchthe search field and where it leads
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Breadcrumb breadcrumb[] · 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
Action actions[] · 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
emphasis'primary' | 'secondary'the first action is primary unless said otherwise
Search search · 5 props
PropTypeDescription
action*stringActionthe page that answers the search
placeholderstringWordsthe search field’s placeholder
namestringDesignthe query’s field name (q by default)
selectsSelect[]menus beside the search field
buttonstringWordsthe button’s words ("Search")
Select search.selects[] · 3 props
PropTypeDescription
name*stringDesignthe field name
label*stringWordsthe menu’s name, e.g. "Status"
options*Option[]the menu’s choices
Option search.selects[].options[] · 2 props
PropTypeDescription
label*stringWordsthe choice’s words, e.g. "Open"
value*stringDesignthe value sent
Options options · 2 props
PropTypeDescription
heading'h1' | 'h2'h2 by default: a block’s title; h1 when the heading opens the page
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 }
canwhether the page has this action
Linkyour router’s link component
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
  • No motion; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: breadcrumb[], actions[], search

A page heading section, for catalog, app, account, landing pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.

More page heading blocks

  • Centered: collections and help pages: title and lead centred, one call to action.
  • Profile avatar centered: a person’s or a community’s page where the identity leads (a member, a creator, a club): the picture large and centred, everything under it centred, the tabs under a hairline.
  • Profile avatar left: a person, a company or a space: a large picture or monogram beside the title, state and facts, with the views as tabs under it.
  • Record pager bar: records read one after the other (a ticket, an order in a queue): a back link and "8 of 42" with previous and next above the title, its state beside it.
  • Stats tiles: overviews: the title, then three or four compact tiles with a value, a label and a change.
  • Steps stepper: multi-step setups: the title, a lead and a stepper showing done, current and to do.
  • Tabs underline tabs: lists with views: the title, then underline tabs with their counts, a search beside the title if there is one.
  • With actions: records and documents: the title and its facts at the left, one or two buttons at the right.

All 9 page heading blocks