Skip to content
Readsmith

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

cURLbash
curl https://api.example.com/v1/pets \
  -H "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.

Was this page helpful?