Quiz Share
Quiz Share
The QuizShare component renders a single button that shares a finished quiz run: the result badge PNG (rendered by Quiz on the results screen) together with a compact, spoiler-free text summary, a headline, a grid of emoji standing in for correct and incorrect answers, the score, the tier, and a link back to the quiz. It works through a fallback chain, native file share, clipboard image, download, down to a text-only share if the badge is unavailable.
It appears automatically on the Quiz hub mode results screen once a run finishes above the learning tier, but it can also be used standalone anywhere a finished quiz result needs a share action.
Basic Usage
import QuizShare from '@site/src/components/QuizShare';
<QuizShare
quizTitle="Wallet Security"
results={[true, true, false, true, true]}
score={4}
total={5}
tierKey="silver"
tierLabel="Silver"
/>
Live Preview:
Without a getBadgeBlob prop, as in the preview above, there is no rendered badge to share, so clicking the button falls straight to the text-only share described below.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
quizTitle | string | required | Quiz title, shown in the share headline |
results | array of boolean | required | One entry per question, true for correct, rendered as a blue/white circle grid in the share text |
score | number | required | Number of correct answers |
total | number | required | Number of questions |
tierKey | string | required | Tier key, bronze, silver, or gold. Picks the default url (that tier's share page) |
tierLabel | string | required | Localized tier label shown next to the score, for example Gold |
url | string | the tier's share page, e.g. https://cardano.org/quiz/share/gold | Link included at the end of the share text. Falls back to https://cardano.org/quiz if tierKey does not match a known tier |
getBadgeBlob | function | undefined | () => Promise<Blob>. Returns the badge PNG render already in flight on the result screen (see Quiz), so the share button reuses that exact image instead of rendering a second one. Left out, or if it rejects, the share falls straight back to the text-only summary |
The Wordle Pattern
The share text is deliberately made of a headline, a row of emoji, the score, the tier, and a link, and nothing else: no question text, no answer options, no explanations. This is the pattern Wordle popularized for its daily grid, and it works for the same reason here: sharing a result never spoils the quiz content for whoever receives it.
Cardano Quiz: Wallet Security
🔵🔵⚪🔵🔵 4/5, Silver
Can you get gold? https://cardano.org/quiz/share/silver
The text is built by the named export buildShareText({ quizTitle, results, score, total, tierLabel, url }), importable on its own for tests or previews without rendering the component:
import { buildShareText } from '@site/src/components/QuizShare';
buildShareText({
quizTitle: 'Wallet Security',
results: [true, true, false, true, true],
score: 4,
total: 5,
tierLabel: 'Silver',
url: 'https://cardano.org/quiz/share/silver',
});
This same text travels as the accompanying message alongside the badge image everywhere the image is shared or downloaded, and it is the entire message in the text-only fallback.