Code block with language tabs (JavaScript, Python, cURL, Go) and Shiki syntax highlighting. Dark theme with copy-to-clipboard and active tab indicator.
Tabbed code snippet block for API "quick start" sections: a row of language tabs (JavaScript, Python, cURL, Go in the demo) above a Shiki-highlighted, always-dark code panel with a copy-to-clipboard button.
Free block
This block is free. No license or account is required: install it with the CLI and use it in unlimited projects.
Radix flavor
npx shadcn add "https://ui.beste.co/r/devtools3"Base UI flavor
npx shadcn add "https://ui.beste.co/r-base/devtools3"This installs the block to components/beste/block/devtools3.tsx, the Button shadcn/ui primitive it uses, and the shiki npm dependency it needs for syntax highlighting.
The installed file exports devtools3Demo alongside the block: the exact props behind the preview above. Spread it to get a working code-tabs panel in one line.
import { Devtools3, devtools3Demo } from "@/components/beste/block/devtools3";
export default function DocsPage() {
return <Devtools3 {...devtools3Demo} />;
}Then replace the demo with your own props. Written out, a trimmed setup looks like this:
import { Devtools3 } from "@/components/beste/block/devtools3";
export default function DocsPage() {
return (
<Devtools3
heading="Install the SDK"
description="Pick your language to get started."
tabs={[
{
language: "javascript",
label: "JavaScript",
code: `npm install @acme/sdk`,
},
{
language: "bash",
label: "cURL",
code: `curl https://api.acme.com/v1/ping`,
},
]}
labels={{ copy: "Copy", copied: "Copied!" }}
/>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
heading | string | – | Section heading above the code panel |
description | string | – | Supporting text under the heading |
tabs | CodeTab[] | [] | Language tabs, each with its own code sample |
labels | { copy?: string; copied?: string } | {} | Copy-button text, before and after copying |
className | string | – | Extra classes for the outer <section> |
type CodeTab = {
language: string;
label: string;
code: string;
};useEffect keyed on activeTab calls Shiki's codeToHtml with theme: "github-dark" and injects the result via dangerouslySetInnerHTML, so there's a brief moment on first paint (and on each tab switch) before the async highlight resolves.navigator.clipboard.writeText on the active tab's raw code, flips to a checkmark plus the copied label, and reverts to the copy label automatically after 2 seconds via setTimeout.setIsCopied(false) fires inside the tab's own onClick), so the button always reads "Copy" again after a tab change even if you just copied on the previous tab.bg-zinc-950, border-zinc-800, Shiki's github-dark theme) regardless of the page's light/dark mode; only the active tab's underline uses the semantic border-primary token.tab.language, so two tabs sharing the same language value will collide during reconciliation; keep each tab's language field unique even if their displayed label differs.devtools20
Unified code diff viewer with dark terminal background. Green additions, red deletions, and gray context lines with file headers.
devtools7
API documentation cards showing response examples with color-coded status badges. Headers section, JSON body with copy button, success/error variants.
devtools6
Terminal-style structured log viewer with level filtering. Color-coded INFO, WARN, ERROR, and DEBUG entries with timestamps and source labels.
devtools14
Interactive JSON editor with format, minify, and real-time validation. Valid/invalid status badge, copy button, and syntax error display.
devtools19
Grouped keyboard shortcuts with styled keycap visuals. Shows key combinations with shadow-styled kbd elements and descriptions.
devtools52
JavaScript bundle analysis with chunk breakdown. Visual size bars, module lists, and gzip comparisons. Color-coded by type: app code, vendor, assets.