Code Snippet Card

Dark editor card with three traffic-light dots, a filename tab, and line-numbered code.

greet.ts
export function greet(name: string) {
return `Hello, ${name}!`;
}
 
console.log(greet("Beste"));

Requires shadcn/ui initialized. Run npx shadcn@latest init if you haven't.

Import & use
import { Code2 } from "@/components/beste/piece/code2";

<Code2
  title="greet.ts"
  lines={[
    "export function greet(name: string) {",
    "  return `Hello, ${name}!`;",
    "}",
    "",
    "console.log(greet(\"Beste\"));"
  ]}
/>