view command fetches and displays registry items in JSON format. Use it to inspect component metadata, dependencies, and source code.
Usage
Arguments
The item names or URLs to view. Can be component names, URLs, or local paths.
Options
The working directory. Defaults to the current directory.
Examples
View a single component
View multiple components
View from URL
View from local path
View in specific directory
What it does
- Reads your
components.json(if it exists) or uses default configuration - Resolves registry URLs for the requested items
- Fetches item metadata and content from the registry
- Outputs the complete item data as JSON
Output structure
Each registry item includes:name- Component nametype- Registry type (registry:ui, registry:block, etc.)dependencies- npm packages requireddevDependencies- npm dev packages requiredregistryDependencies- Other shadcn components requiredfiles- Array of file objects with path and contentmeta- Additional metadata
Registry types
Components can have different types:registry:ui- UI componentsregistry:block- Larger UI blocksregistry:hook- React hooksregistry:lib- Library utilitiesregistry:theme- Theme configurationsregistry:style- Style systemsregistry: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 likejq:
Notes
- Output is always valid JSON
- Returns an array of items, even for a single component
- Supports partial
components.jsonfiles - Automatically configures registries if needed
- Works without a
components.jsonfile (uses defaults)