# Before/After Code Diff

https://fieldbook.lizardi.mx/components/before-after-code-diff

Category: Data display
![Still of the Before/After Code Diff component, a Fieldbook UI component in Data display.](https://fieldbook.lizardi.mx/thumbs/before-after-code-diff.webp)
Preview video: https://ejpqcxcjbiyabxkx.public.blob.vercel-storage.com/previews/before-after-code-diff-7c45cf990c.mp4 (5 s, silent)

Before/After Code Diff: Two code panels side by side, labeled before and after, with added and removed lines tinted and a hover focus effect.

## Frameworks

react, vue, svelte, astro, html

## Preview controls

These controls are passed to the demo. Defaults and limits describe the preview; consult the implementation for its full prop API.

| Name | Type | Default | Options or constraints |
| --- | --- | --- | --- |
| accent | color | #38BDF8 | No additional limit in the metadata. |
| fontSize | number | 13 | From 11 to 16; step 1 |
| showLineDiff | boolean | true | No additional limit in the metadata. |
| focusBlurOnHover | boolean | true | No additional limit in the metadata. |

## Usage notes

Before/After Code Diff uses the wide preview frame with a dark theme setting.

### Which frameworks are available for Before/After Code Diff?

Before/After Code Diff is available for React, Vue, Svelte, Astro, HTML. The live preview uses React; the source observations below apply to index.tsx. Check the selected port before relying on the same interactions.

### What does Before/After Code Diff depend on?

The React metadata lists these npm dependencies beyond React: clsx.

### What accessibility details are visible in Before/After Code Diff?

The React source for Before/After Code Diff includes: attributes and handlers (aria-hidden). These are source observations. Verify accessible names, focus order and keyboard behavior in the composed page.

### How does Before/After Code Diff handle reduced motion?

The source scan found no direct useReducedMotion() or matchMedia preference read in Before/After Code Diff's index.tsx. Check the full implementation, shared styles and selected port with reduced motion enabled; these observations do not establish that every animation stops.

## Install through MCP

Connect your client, call get_component to retrieve the implementation, then get_install_command for installation instructions. Choose a listed framework, integrate the returned source and verify it in your application.

```json
{
  "tool": "get_component",
  "arguments": {
    "slug": "before-after-code-diff",
    "framework": "react"
  }
}
```

[For agents](https://fieldbook.lizardi.mx/docs/agents)
[MCP](https://fieldbook.lizardi.mx/api/mcp)

## Related open components

- [Animated metric counter](https://fieldbook.lizardi.mx/components/animated-metric-counter)
- [Billing Ledger Table](https://fieldbook.lizardi.mx/components/billing-ledger-table)
- [Concentric goal rings](https://fieldbook.lizardi.mx/components/concentric-goal-rings)
- [Counting number readout](https://fieldbook.lizardi.mx/components/counting-number-readout)
- [Credit balance ledger](https://fieldbook.lizardi.mx/components/credit-balance-ledger)
- [Detail list item](https://fieldbook.lizardi.mx/components/detail-list-item)
