Questions answers accordion — FAQ block

Pro

faq-questions-answers-accordion · for product pages

Questions answers accordion

Native disclosures, initially open, for longer answers; the merchant’s own only.

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-questions-answers-accordion

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import FaqQuestionsAnswersAccordion from '@/components/trame/blocks/faq/faq-questions-answers-accordion.vue'

const props = {
title: "Talk it through before you choose",
intro: "Demo editorial questions, with no customer testimonials or fictional owners.",
cta: {
label: "Ask a question",
action: "ask-question"
},
items: [
{
question: "How should I describe my request?",
answer: "Say how you plan to use it and which points you’d like clarified.",
by: {
name: "Demo team"
},
role: "team"
},
{
question: "Where can I find the useful information?",
answer: "Check the description and the documents attached to the product.",
by: {
name: "Demo team"
},
role: "team"
}
]
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe section’s heading
introstringWordsa sentence or two under the heading
items*Item[]Datathe items shown, in order
ctaCtathe call to action: its words and the page action it runs
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Item items[] · 8 props
PropTypeDescription
question*stringWordsthe visitor’s question
answer*stringWordsthe answer
by*Bywho answered
role*'team' | 'owner'who answered: someone of the team or the owner
verifiedbooleantrue: the answer’s origin is verified
tenurestringWordshow long the person has been there, e.g. "4 years in the shop"
responseTimestringWordshow long the answer took, e.g. "2 days"
datestringWordsthe date, as the merchant writes it
By items[].by · 6 props
PropTypeDescription
idstring | numberDatathe record’s id in the tool that answers it
name*stringWordsthe person’s name
rolestringWordstheir role or job title
companystringWordswhere they work
avatarstringPicturea picture: a root-relative path (/media/…) or an absolute URL
urlstringDesigna page about them
Cta cta · 2 props
PropTypeDescription
label*stringWordsthe words on the button or link
action*stringActiona named action of the page
Options options · 1 props
PropTypeDescription
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: cta
  • Reads questions from your app

A faq section, for product pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.

More faq blocks

  • 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.
  • Published answers cards: short self-contained answers set as cards in a grid that adapts to the count: a help centre’s front.
  • Published answers open: 4 to 8 short answers, nothing folded: every word visible and indexable at once.
  • Question table: ruled rows of question, one-line answer (the verdict) and topic tag, each opening on the full answer: many short answers scanned like a table.
  • Topic answers pills: one long page grouped by topic, pills only filtering it: nothing to navigate, everything readable.
  • Topic answers tabs: 3 to 5 topics as a tab bar over one list of questions: a help set that splits cleanly.
  • Two columns: 8 to 14 short questions split in two columns, to avoid a long scroll.

All 20 faq blocks