Skip to main content
The view command fetches and displays registry items in JSON format. Use it to inspect component metadata, dependencies, and source code.

Usage

Arguments

string[]
required
The item names or URLs to view. Can be component names, URLs, or local paths.

Options

string
The working directory. Defaults to the current directory.

Examples

View a single component

Output:

View multiple components

View from URL

View from local path

View in specific directory

What it does

  1. Reads your components.json (if it exists) or uses default configuration
  2. Resolves registry URLs for the requested items
  3. Fetches item metadata and content from the registry
  4. Outputs the complete item data as JSON

Output structure

Each registry item includes:
  • name - Component name
  • type - Registry type (registry:ui, registry:block, etc.)
  • dependencies - npm packages required
  • devDependencies - npm dev packages required
  • registryDependencies - Other shadcn components required
  • files - Array of file objects with path and content
  • meta - Additional metadata

Registry types

Components can have different types:
  • registry:ui - UI components
  • registry:block - Larger UI blocks
  • registry:hook - React hooks
  • registry:lib - Library utilities
  • registry:theme - Theme configurations
  • registry:style - Style systems
  • registry:base - Base configurations

Use cases

Inspect before adding

Review a component’s structure and dependencies before installing:

Extract component source

Get the raw source code for inspection:

Check registry dependencies

See which other components are required:

Compare versions

Fetch and compare different component versions:

Working with output

The JSON output can be processed with tools like jq:

Notes

  • Output is always valid JSON
  • Returns an array of items, even for a single component
  • Supports partial components.json files
  • Automatically configures registries if needed
  • Works without a components.json file (uses defaults)