General
stable
Code Block
Use Code Block by copying the source file or importing it into your UI layer.
Preview
tsx
const preview = "live";Import
tsx
import { CodeBlock } from "@/components/ui/code-block";bash
npx sui add code-blockSource
From components/ui/code-block.tsx
tsx
import React from "react";
import { Snippet } from "./snippet";
interface CodeBlockProps {
code: string;
language?: string;
filename?: string;
}
// CodeBlock is a thin wrapper around Snippet for backward compatibility
export const CodeBlock = ({ code, language = "tsx", filename }: CodeBlockProps) => {
return <Snippet code={code} language={language} filename={filename} />;
};
Component Info
Slug
code-blockCategory
General
Status
stable
Quick Actions
Tags
code-block