components/ui/button.jsx+3−2
Installation
$ pnpm dlx shadcn@latest add @synccn/code-diffFirst time in this project? Connect synccn with one command.
Usage
import { CodeDiff } from "@/components/ui/code-diff";<CodeDiff before={a} after={b} filename="button.jsx" />API reference
Generated from the component's TypeScript types, so it always matches the code.
CodeDiff
Unified or split view of the changes between two versions of a file.
PropTypeDescription
- beforerequired
stringOriginal text.
- afterrequired
stringChanged text.
- filename
stringShown in the header.
- defaultView
"unified" | "split"Default
"unified"View shown first.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-pressed
- Keys handled: Space
More display
CardSurface with header, content and footer slots.BadgeSmall status label with an optional dot.AvatarImage with initials fallback, presence dot and stacked groups.KbdKeyboard key for shortcuts and hints.SeparatorHorizontal, vertical or labelled divider.AccordionExpanding sections with smooth height animation.