Skip to content

Quizz

To create quizzes related to a video, use the <Quiz> component.

Preview

Which framework is Starlight built on top of?

import { Quiz, QuizOption } from 'starlight-videos/components'

Display a quiz related to a video using the <Quiz> and <QuizOption> components. The <Quiz> component requires a title attribute to give context to the quiz and the <QuizOption> components to define the possible answers with the correct attribute to mark the correct answer.

import { Quiz, QuizOption } from 'starlight-videos/components'
<Quiz title="Which framework is Starlight built on top of?">
<QuizOption>Nuxt</QuizOption>
<QuizOption correct>Astro</QuizOption>
<QuizOption>Next</QuizOption>
</Quiz>
Preview

Which framework is Starlight built on top of?

Use the multiple attribute on the <Quiz> component to allow multiple correct answers and mark them with the correct attribute on the <QuizOption> components.

import { Quiz, QuizOption } from 'starlight-videos/components'
<Quiz title="Which content formats are supported in Starlight?" multiple>
<QuizOption>CSV</QuizOption>
<QuizOption correct>Mardown</QuizOption>
<QuizOption>Latex</QuizOption>
<QuizOption correct>MDX</QuizOption>
</Quiz>
Preview

Which content formats are supported in Starlight?

Customize the appearance of a quizz by using the variant attribute which can be set to minimal (the default), caution, danger, note, success, or tip.

import { Quiz, QuizOption } from 'starlight-videos/components'
<Quiz title="Do you have a cup of coffee or tea ready?" variant="caution">
<QuizOption correct>Yes</QuizOption>
<QuizOption>No</QuizOption>
</Quiz>
<Quiz title="What is a difficult thing to do?" variant="danger">
<QuizOption>Installing Starlight</QuizOption>
<QuizOption correct>Naming things</QuizOption>
</Quiz>
<Quiz title="Which framework is Starlight built on top of?" variant="note">
<QuizOption>Nuxt</QuizOption>
<QuizOption correct>Astro</QuizOption>
<QuizOption>Next</QuizOption>
</Quiz>
<Quiz title="Which language is Starlight written in?" variant="success">
<QuizOption correct>TypeScript</QuizOption>
<QuizOption>Python</QuizOption>
</Quiz>
<Quiz title="Should you use at least one aside block per page?" variant="tip">
<QuizOption correct>No</QuizOption>
<QuizOption>Yes</QuizOption>
</Quiz>
Preview

Do you have a cup of coffee or tea ready?

What is a difficult thing to do?

Which framework is Starlight built on top of?

Which language is Starlight written in?

Should you use at least one aside block per page?

The <Quiz> component accepts the following props:

required
type: string

The title of the quiz.

type: boolean
default: false

Allow multiple correct answers.

type: 'caution' | 'danger' | 'minimal' | 'note' | 'success' | 'tip'
default: 'minimal'

The appearance of the quiz.

The <QuizOption> component accepts the following props:

type: boolean
default: false

Mark the answer as correct.