Quiz all at once — Article block

Pro

article-quiz-all-at-once · for article, home, landing pages

Quiz all at once

Every question in one column, the score at the end: a short quiz read like an article

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/article-quiz-all-at-once

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import ArticleQuizAllAtOnce from '@/components/trame/blocks/article/article-quiz-all-at-once.vue'

const props = {
title: "Do you know how to care for your bag?",
lead: "Six questions, two minutes. Each answer is explained as you go.",
questions: [
{
question: "Which leather develops the most beautiful patina?",
choices: [
"Chrome-tanned leather",
"Vegetable-tanned leather"
],
answer: 1,
explanation: "Vegetable tanning lets the leather breathe: it darkens and softens with use, while coated leather stays as it is."
},
{
question: "How often should you condition a leather bag?",
choices: [
"Every week",
"Twice a year"
],
answer: 1,
explanation: "Twice a year is enough. Too much cream smothers the leather; too little dries it out."
}
],
results: [
{
min: 0,
title: "A good start",
text: "Our care guide is waiting for you: a ten-minute read, and your bag will thank you."
},
{
min: 3,
title: "You know the basics",
text: "Just a few more habits and your leather will age beautifully."
}
],
options: {
eyebrow: "Quiz"
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe quiz’s title ("Which leather is right for you?")
leadstringWordswhat it is and how long it takes
questions*Question[]the questions shown, in order
resultsResult[]what each score range means
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Question questions[] · 4 props
PropTypeDescription
question*stringWordsthe question
choices*string[]Wordsthe question’s choices, in order
answer*numberthe index (from 0) of the right choice
explanation*stringWordswhy it is the right one, shown after the visitor chooses
Result results[] · 3 props
PropTypeDescription
min*numberthe lowest score (right answers) this message applies to
title*stringWordsthe result’s title
textstringWordsthe result’s text
Options options · 2 props
PropTypeDescription
eyebrowstringWordsthe section ("Quiz")
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
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

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

More article blocks

  • List numbered: a numbered article read top to bottom: a number in the margin, the entry, an optional picture beside it.
  • List ranked: big numerals and pictures alternating sides: a ranking or a countdown the visitor reads with pleasure.
  • Long guide toc rail: a long guide with several headings: a sticky "on this page" rail with the article’s dates beside the text.
  • Passage strip cards: Equal excerpt cards for real extracts of linked articles only.
  • Passage strip stacked big: One large opening extract and a quiet reading list, for real linked extracts only.
  • Reader desk accordion ask: questions that open onto their answer, the first one open: many questions, little room.
  • Reader desk column case: numbered cases told in labelled columns (what happened, why, the lesson): repairs and lessons learnt.
  • Reader desk field notes: short note cards with the place and the years of use: readers telling how they use what they bought.

All 29 article blocks