code-block-demo
cult-ui/code-block-demoFreeComponent
cult/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/nolly-studio/cult-ui/HEAD/apps/www/public/r/styles/default/code-block-demo.jsonSource
1import { CodeBlock } from "@/registry/default/ui/code-block"23function CodeBlockDemo() {4 return (5 <main className=" ">6 <div className="mx-auto space-y-8">7 {/* Multi-tab example */}8 <div className="space-y-3">9 <h2 className="text-xl font-semibold">10 Package Manager Installation11 </h2>12 <CodeBlock13 tabs={[14 {15 label: "npm",16 code: "npm install @acme/ui",17 language: "bash",18 },19 {20 label: "pnpm",21 code: "pnpm add @acme/ui",22 language: "bash",23 },24 {25 label: "yarn",26 code: "yarn add @acme/ui",27 language: "bash",28 },29 {30 label: "bun",31 code: "bun add @acme/ui",32 language: "bash",33 },34 ]}35 />36 </div>3738 {/* Single code block example */}39 <div className="space-y-3">40 <h2 className="text-xl font-semibold">Single Code Block</h2>41 <CodeBlock42 code={`import { CodeBlock } from '@/components/code-block'4344export default function Page() {45 return (46 <CodeBlock47 code="console.log('Hello, world!')"48 language="javascript"49 />50 )51}`}52 language="tsx"53 />54 </div>5556 {/* API example */}57 <div className="space-y-3">58 <h2 className="text-xl font-semibold">API Configuration</h2>59 <CodeBlock60 tabs={[61 {62 label: ".env.local",63 code: `NEXT_PUBLIC_API_URL=https://api.example.com64API_SECRET_KEY=your-secret-key`,65 language: "bash",66 },67 {68 label: "config.ts",69 code: `export const config = {70 apiUrl: process.env.NEXT_PUBLIC_API_URL,71 apiKey: process.env.API_SECRET_KEY,72}`,73 language: "typescript",74 },75 ]}76 />77 </div>78 </div>79 </main>80 )81}8283export default CodeBlockDemo
What it pulls in
Other registry items
Files it writes
More from cult/ui
All 157 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-instructionsai-instructions | cult/ui | Components | Free | 2 deps | |
| ai-instructions-demoai-instructions-demo | cult/ui | Components | Free | no deps | |
| animated-numberanimated-number | cult/ui | Components | Free | 1 dep | |
| animated-number-demoanimated-number-demo | cult/ui | Components | Free | no deps | |
| bg-animate-buttonbg-animate-button | cult/ui | Components | Free | no deps | |
| bg-animate-button-demobg-animate-button-demo | cult/ui | Components | Free | no deps | |
| bg-animated-fractal-dot-gridbg-animated-fractal-dot-grid | cult/ui | Components | Free | 1 dep | |
| bg-animated-fractal-dot-grid-demobg-animated-fractal-dot-grid-demo | cult/ui | Components | Free | no deps |
