# Multiple choice

Choice questions are written as a markdown task list. The number of correct answers decides the question type. You
never set it explicitly.

## Single choice (radio buttons)

Exactly one correct answer renders as radio buttons. Single-choice quizzes [auto-submit](/starlight-quiz/guides/configuration/#autosubmit)
on selection by default:

<Quiz id="mc-single">
What is the capital of France?

- [ ] London
- [x] Paris
- [ ] Berlin

</Quiz>

```mdx title="quiz.mdx"
<Quiz>
What is the capital of France?

- [ ] London
- [x] Paris
- [ ] Berlin
</Quiz>
```

## Multiple choice (checkboxes)

:::caution[Recognised markers]
`[x]`, `[ ]` and `[X]` are recognised, and `[]` (no inner space) counts as an unchecked answer. A mistyped marker
(`[o]` or a “smart” bracket pasted from an editor) isn't a checkbox in markdown, so it would silently never be an
answer. The build fails with an error pointing at it (disable with the
[`validate`](/starlight-quiz/guides/configuration/#validate) option). Also don't mix `-` and `*` bullets within one
quiz, as that splits the answer list.
:::

More than one correct answer renders as checkboxes with a Submit button. The reader must select **all** correct
answers and **only** the correct answers:

<Quiz id="mc-multiple">
Which of these are even numbers?

- [x] 2
- [ ] 3
- [x] 4
- [ ] 5

</Quiz>

```mdx title="quiz.mdx"
<Quiz>
Which of these are even numbers?

- [x] 2
- [ ] 3
- [x] 4
- [ ] 5
</Quiz>
```

## Per-answer feedback

Add a blockquote (`>`) indented underneath an answer to show feedback specific to that choice after submitting. Each
feedback box is badged with the answer it belongs to, so it is always clear which choice the note responds to.

### Single choice

Pick an answer to reveal its feedback:

<Quiz id="mc-feedback">
Which language runs natively in the browser?

- [x] JavaScript
  > Correct. JavaScript is the language of the web.
- [ ] Python
  > Python needs a server or a runtime like Pyodide to run in the browser.
- [ ] C++

</Quiz>

````mdx title="quiz.mdx"
<Quiz>
Which language runs natively in the browser?

- [x] JavaScript
  > Correct. JavaScript is the language of the web.
- [ ] Python
  > Python needs a server or a runtime like Pyodide to run in the browser.
- [ ] C++
</Quiz>
````

### Multiple choice

When more than one selected answer carries feedback, every box is shown together — the badges keep them apart. Select
a few options below before submitting:

<Quiz id="mc-feedback-multiple">
Which of these are programming languages?

- [x] Python
  > Yes — a general-purpose programming language.
- [x] Rust
  > Yes — a systems programming language.
- [ ] HTML
  > No — HTML is a markup language for structuring content.
- [ ] HTTP
  > No — HTTP is a protocol for transferring data over the web.

</Quiz>

````mdx title="quiz.mdx"
<Quiz>
Which of these are programming languages?

- [x] Python
  > Yes — a general-purpose programming language.
- [x] Rust
  > Yes — a systems programming language.
- [ ] HTML
  > No — HTML is a markup language for structuring content.
- [ ] HTTP
  > No — HTTP is a protocol for transferring data over the web.
</Quiz>
````

## Content section

Any markdown after the answers becomes a content section that is revealed once the quiz is submitted, handy for
explanations. See [Advanced formatting](/starlight-quiz/guides/advanced-formatting/) for richer content.

<Quiz id="mc-content">
What is Astro?

- [x] A web framework
- [ ] A database
- [ ] A text editor

**Astro** is a web framework for building content-driven websites, with an islands architecture for shipping less
JavaScript.

</Quiz>

```mdx title="quiz.mdx"
<Quiz>
What is Astro?

- [x] A web framework
- [ ] A database
- [ ] A text editor

**Astro** is a web framework for building content-driven websites, with an
islands architecture for shipping less JavaScript.
</Quiz>
```