RequestExample and ResponseExample
Pin code examples in the right sidebar — in place of the normal “On this page” table of contents — instead of inline in the article. On a narrower viewport (below 1150px, where that sidebar column doesn’t render at all) they fall back to a plain in-place code block, so nothing is ever lost, just relocated. Both work exactly like CodeGroup (multiple titled fences become a tab strip, or a dropdown), just displayed in a different place.
Not shown live on this page — using either one here would replace this reference page’s own “On this page” list, which would hurt more than it’d demonstrate:
<RequestExample>
```bash title="Request"
curl --request POST \
--url https://api.example.com/v1/widgets
```
</RequestExample>
<ResponseExample>
```json title="Response"
{ "id": "wdg_123", "status": "created" }
```
</ResponseExample>ResponseExample always docks below RequestExample in the sidebar, regardless of which order they’re written in.
Props (both components take the same one)
A <select> switcher instead of a tab strip, for 2+ titled code blocks.