Componenteditors0.5 KB gzipZero dependencies

Snippet Card

Code snippet card with language badge and copy button.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add snippet-card

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { SnippetCard } from "@/components/ui/snippet-card"; <SnippetCard />

Source code

snippet-card.tsx + 2 helpers

Zero 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 />
PropTypeDescription
codestringConfigures code.
languagestringConfigures language. (Default: "ts")
filenamestringConfigures filename.