Hub search first — FAQ block

Free

faq-hub-search-first · for landing, support, home pages

Hub search first

A large search field and the merchant’s short list of key questions: visitors who know what they look for.

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/faq-hub-search-first

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import FaqHubSearchFirst from '@/components/trame/blocks/faq/faq-hub-search-first.vue'

const props = {
eyebrow: "Help center",
title: "How can we help?",
lead: "Answers to the questions we hear most often, sorted by topic.",
topics: [
{
key: "livraison",
label: "Shipping",
summary: "Delivery times, tracking and carriers",
items: [
{
question: "How long does delivery take?",
answer: "Allow 2 to 4 business days within the contiguous US, 5 to 8 abroad.\n\nThe clock starts when your order ships, not when you place it.",
featured: true
},
{
question: "How do I track my parcel?",
answer: "We send you an email with a tracking link as soon as the parcel leaves the workshop."
}
]
},
{
key: "retours",
label: "Returns and exchanges",
summary: "Deadlines, fees and refunds",
items: [
{
question: "Can I return an item?",
answer: "Yes, within 60 days, in its original condition. The return label is free.",
featured: true
},
{
question: "When will I get my refund?",
answer: "Within 5 business days of receiving the parcel, to the payment method you used."
}
]
}
],
searchPlaceholder: "Search for a question",
help: {
title: "Still have a question?",
text: "We answer Monday to Friday, 9 a.m. to 5 p.m.",
action: {
label: "Write to the team",
action: "contact"
}
}
}
</script>

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

Props

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

PropTypeDescription
eyebrowstringWordswhat this is ("Help centre")
title*stringWordsthe section’s title ("How can we help?")
leadstringWordsone sentence under the title
topics*Topic[]the topics, each with its questions
searchPlaceholderstringWordswhat the search field invites ("Search for a question")
helpHelpa help card for questions left unanswered, with a way to reach the team
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Topic topics[] · 6 props
PropTypeDescription
key*stringDesignthe topic’s key, unique in the list ("delivery")
label*stringWordsthe topic’s name ("Delivery and returns")
summarystringWordsone line saying what the topic covers
actionstringActionthe page of the topic, when it has its own (topic-tiles then link to it)
recordRecord<string, unknown>Datathe record the action opens, if any
items*Item[]the topic’s items, in order
Item topics[].items[] · 3 props
PropTypeDescription
question*stringWordsthe question, as a customer would ask it
answer*stringWordsthe answer, in plain sentences; a blank line starts a new paragraph
featuredbooleanthe merchant chose it for the short list (search-first)
Help help · 3 props
PropTypeDescription
title*stringWordswhat the card offers ("A question left unanswered?")
textstringWordshow to reach the merchant, in a sentence
actionActionthe help box’s call to action: its words and the page action
Action help.action · 3 props
PropTypeDescription
label*stringWordswhat happens ("Write to the team")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Options options · 2 props
PropTypeDescription
openFirstbooleanfalse: every answer starts closed; by default the first one is open
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
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: topics[], help.action

A faq section, for landing, support, home pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.

Built with

The components this block is made of; each one installs on its own too.

More faq blocks

  • Aside intro: the title, lead and help card in a sticky column beside the accordion: a landing or shop page where the FAQ sits next to a reassuring intro.
  • Ask docked: the questions as an accordion in a card, and docked under it a field where the visitor asks their own question and sends it to the merchant: a shop or landing page whose team answers questions by e-mail.
  • Assisted questions sidebar: a title, a help card and a picture on one side, the questions on the other: when a person can be reached.
  • Card grid: one card per question with its topic as a kicker, the help card as a bar under the grid: six to eight short answers to skim.
  • Grouped: a long FAQ sorted by theme, each theme its own short accordion with an index above it.
  • Illustrated answers numbered: the few things to know, told in order with a large index, no accordion: an editorial tone.
  • Illustrated answers verdicts: a policy FAQ where each answer is a word or a figure ("Yes", "60 days") set before the question.
  • Open numbered: every answer visible as a numbered list in two columns: five to eight short answers to read without clicking.

All 20 faq blocks