Questions answers accordion — FAQ block
Profaq-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-accordionUsage
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.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s heading |
| intro | string | Wordsa sentence or two under the heading |
| items* | Item[] | Datathe items shown, in order |
| cta | Cta | the call to action: its words and the page action it runs |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Item items[] · 8 props
| Prop | Type | Description |
|---|---|---|
| question* | string | Wordsthe visitor’s question |
| answer* | string | Wordsthe answer |
| by* | By | who answered |
| role* | 'team' | 'owner' | who answered: someone of the team or the owner |
| verified | boolean | true: the answer’s origin is verified |
| tenure | string | Wordshow long the person has been there, e.g. "4 years in the shop" |
| responseTime | string | Wordshow long the answer took, e.g. "2 days" |
| date | string | Wordsthe date, as the merchant writes it |
By items[].by · 6 props
| Prop | Type | Description |
|---|---|---|
| id | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe person’s name |
| role | string | Wordstheir role or job title |
| company | string | Wordswhere they work |
| avatar | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| url | string | Designa page about them |
Cta cta · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| 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 } |
| can | whether the page has this action |
| Link | your router’s link component |
| 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:
cta - Reads
questionsfrom 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.