Code groups
When one request exists in several languages, a CodeGroup stacks the blocks behind a switcher so the reader picks once and the page stays short. Each fenced block's title becomes its tab label.
A code group
curl https://api.example.com/v1/pets \
-H "X-Api-Key: $KEY"const res = await fetch("https://api.example.com/v1/pets", {
headers: { "X-Api-Key": process.env.KEY },
});import requests
res = requests.get(
"https://api.example.com/v1/pets",
headers={"X-Api-Key": KEY},
)Usage
<CodeGroup>
```bash title="cURL"
curl https://api.example.com/v1/pets
```
```ts title="TypeScript"
const pets = await fetch(...)
```
</CodeGroup>Leave a blank line between the component tags and the fences; the blocks are ordinary Markdown code blocks in every other way, including line emphasis meta.