Diff View

button.tsx
export function Button({ label }) {
return <button>{label}</button>;
return <button className="btn">{label}</button>;
}
About this piece

Diff View

Unified diff with tinted add and remove rows, line numbers, and +/− prefix column.

Usage

The import and the props worth knowing about, in one place.

import { Editor4 } from "@/components/beste/piece/editor4";

<Editor4
  surface="card"
  bordered={false}
  inverted={false}
  filename="button.tsx"
  lines={[
    {
      "kind": "context",
      "line": 12,
      "content": "export function Button({ label }) {"
    },
    {
      "kind": "remove",
      "line": 13,
      "content": "  return <button>{label}</button>;"
    },
    {
      "kind": "add",
      "content": "  return <button className=\"btn\">{label}</button>;"
    },
    {
      "kind": "context",
      "line": 14,
      "content": "}"
    }
  ]}
/>

More Editor pieces

View all Editor
const name = 'Hania';
const role = 'design';
const team = 'core';
1function·greet(name)·{
2→return·`Hello,·${name}!`;
3}
--primary: #f43f5e;
--accent: #8b5cf6;
--surface: #0ea5e9;
const greet = (name: string) => `Hello, ${name}!`;
for (let $1:i = 0; $1 < $2:arr.length; $1++) {}
/\b\w+@\w+\.com\b/gi
12