Componenteditors0.5 KB gzipZero dependencies
Snippet Card
Code snippet card with language badge and copy button.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add snippet-cardOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { SnippetCard } from "@/components/ui/snippet-card"; <SnippetCard />Source code
snippet-card.tsx + 2 helpersZero third-party dependencies (3 local files shown in tabs below).
tsxsnippet-card.tsx30 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils";import { CopyButton } from "./copy-button"; export interface SnippetCardProps extends React.HTMLAttributes<HTMLDivElement> { code: string; language?: string; filename?: string;} /** Code snippet card: language badge + copy button + dashed frame. */export function SnippetCard({ code, language = "ts", filename, className, ...props }: SnippetCardProps) { return ( <div className={cn("group w-full overflow-hidden rounded-lg border border-border bg-card", className)} {...props}> <div className="flex items-center justify-between border-b border-border bg-secondary/60 px-3 py-1.5"> <div className="flex items-center gap-2">Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { SnippetCard } from "@/components/ui/snippet-card"; <SnippetCard />| Prop | Type | Description |
|---|---|---|
| code | string | Configures code. |
| language | string | Configures language. (Default: "ts") |
| filename | string | Configures filename. |