CodeSamplePanel

Domain

Dark-themed panel showing code samples in multiple languages with tab switching and a one-click copy button.

Multi-language sample

Preview
curl -X GET 'https://api.example.com/v1/users?page=1&pageSize=20' \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json'
Code
<CodeSamplePanel samples={[
  { lang: 'curl', label: 'cURL', source: `curl -X GET 'https://api.example.com/v1/users'` },
  { lang: 'javascript', label: 'JavaScript', source: `const res = await fetch('/users');` },
  { lang: 'python', label: 'Python', source: `import requests\nr = requests.get('/users')` },
]} />

Single language

Preview
#!/bin/bash
TOKEN=$(curl -s -X POST https://api.example.com/auth/token \
  -H 'Content-Type: application/json' \
  -d '{"email":"admin@example.com","password":"secret"}' | jq -r .accessToken)

curl -H "Authorization: Bearer $TOKEN" https://api.example.com/v1/users
Code
<CodeSamplePanel samples={[{ lang: 'bash', label: 'Shell', source: '...' }]} />
Sourcemodules/domains/api-doc/CodeSamplePanel.tsx