Skip to main content
The diff command checks for updates to your installed components against the registry. It compares your local files with the latest versions and shows differences.

Usage

shadcn diff [component]

Arguments

component
string
The component name. If not provided, checks all installed components for updates.

Options

--yes
boolean
default:"false"
Skip confirmation prompt.
--cwd
string
The working directory. Defaults to the current directory.

Examples

Check all components for updates

shadcn diff
Output:
The following components have updates available:
- button
  - components/ui/button.tsx
- card
  - components/ui/card.tsx

Run diff <component> to see the changes.

Check a specific component

shadcn diff button
Output:
- components/ui/button.tsx
- import * as React from "react"
+ import { forwardRef } from "react"
  import { Slot } from "@radix-ui/react-slot"
  import { cva, type VariantProps } from "class-variance-authority"
  
  import { cn } from "@/lib/utils"
  
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
+ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
    ({ className, variant, size, asChild = false, ...props }, ref) => {
      const Comp = asChild ? Slot : "button"

Check component in specific directory

shadcn diff button --cwd ./my-project

What it does

  1. Reads your components.json configuration
  2. Fetches the latest version from the registry
  3. Compares local files with registry versions
  4. Shows a line-by-line diff of changes
  5. Highlights additions in green and removals in red

Use cases

Track component updates

Regularly check for updates to installed components:
shadcn diff

Review changes before updating

Before manually updating a component, review what changed:
shadcn diff button

Verify customizations

Check if your customizations conflict with upstream changes:
shadcn diff card

Output format

The diff output uses standard diff notation:
  • Lines starting with - (red) are removed in the registry version
  • Lines starting with + (green) are added in the registry version
  • Lines without prefix are unchanged

No updates found

If a component is up-to-date:
No updates found for button.
If all components are up-to-date:
No updates found.

Notes

  • The diff compares the transformed registry code against your local files
  • Transformations are applied based on your components.json configuration
  • Only checks components that exist in your project
  • Requires a valid components.json file

Build docs developers (and LLMs) love