Storybook CLI: Develop, document, and test UI components in isolation
—
Create sandbox environments, link repositories, and manage development workflows. These tools help developers experiment with Storybook configurations, test reproductions, and contribute to the Storybook ecosystem.
Create sandbox environments from predefined templates for testing and experimentation.
storybook sandbox [filterValue] [options]
Parameters:
filterValue Optional filter to narrow template selection
Options:
-o, --output <outDir> Define an output directory
--no-init Whether to download a template without an initialized Storybook (default: false)Alias: repro (for backward compatibility)
Usage Examples:
# Create sandbox with interactive template selection
npx storybook sandbox
# Filter templates by name
npx storybook sandbox react
# Create sandbox in specific directory
npx storybook sandbox react --output my-react-sandbox
# Download template without Storybook initialization
npx storybook sandbox vue --no-init
# Using the legacy alias
npx storybook repro angularPull down a repository from URL or local directory, link it, and run Storybook for testing reproductions.
storybook link <repo-url-or-directory> [options]
Parameters:
repo-url-or-directory Target repository URL or local directory path
Options:
--local Link a local directory already in your file system
--no-start Start the storybook (default: true)Usage Examples:
# Link and run remote repository
npx storybook link https://github.com/user/storybook-repro
# Link local directory
npx storybook link ./local-storybook-project --local
# Link without starting Storybook
npx storybook link https://github.com/user/repro --no-start
# Link local directory and start immediately
npx storybook link ../my-storybook-project --localThe sandbox command provides access to extensive templates:
Templates are organized by release cadence:
interface Template {
name: string;
script: string;
cadence: TemplateCadence;
skipTasks?: string[];
inDevelopment?: boolean;
expected: {
framework: string;
renderer: string;
builder: string;
};
}
type TemplateCadence = "ci" | "daily" | "weekly";
type TemplateKey = string;The link command supports various repository sources:
# GitHub repositories
npx storybook link https://github.com/storybookjs/storybook
# GitLab repositories
npx storybook link https://gitlab.com/user/project
# Bitbucket repositories
npx storybook link https://bitbucket.org/user/repo
# Raw git URLs
npx storybook link git@github.com:user/repo.git# Relative paths
npx storybook link ../my-project --local
# Absolute paths
npx storybook link /Users/dev/projects/storybook-app --local
# Current directory
npx storybook link . --localComplete workflow for sandbox creation:
Complete workflow for repository linking:
Both commands work with all supported package managers:
# Create minimal reproduction environment
npx storybook sandbox react --output bug-repro
cd bug-repro
# Add minimal code to reproduce issue# Test new features in sandbox
npx storybook sandbox vue --output feature-test
cd feature-test
# Install and test new addons or features# Explore different framework setups
npx storybook sandbox angular --output angular-exploration
npx storybook sandbox svelte --output svelte-exploration# Test contributions against existing projects
npx storybook link https://github.com/user/storybook-issue-repro
# Test your changes against the reproductionimport { sandbox, link } from "@storybook/cli";
/**
* Create sandbox programmatically
* @param options - Sandbox configuration
*/
function sandbox(options: SandboxOptions): Promise<void>;
/**
* Link repositories programmatically
* @param options - Link configuration
*/
function link(options: LinkOptions): Promise<void>;
interface SandboxOptions {
filterValue?: string;
output?: string;
branch?: string;
init?: boolean;
packageManager: PackageManagerName;
}
interface LinkOptions {
target: string;
local?: boolean;
start: boolean;
}
/**
* Execute shell commands with logging
* @param command - Command to execute
* @param options - Execution options
* @param config - Additional configuration
*/
function exec(
command: string,
options?: ExecOptions,
config?: ExecConfig
): Promise<unknown>;Programmatic Examples:
import { sandbox, link } from "@storybook/cli";
// Create sandbox programmatically
await sandbox({
filterValue: "react",
output: "my-sandbox",
init: true,
packageManager: "npm"
});
// Link repository programmatically
await link({
target: "https://github.com/user/repro",
local: false,
start: true
});# Organize sandboxes by purpose
npx storybook sandbox react --output sandboxes/react-testing
npx storybook sandbox vue --output sandboxes/vue-debugging# Filter by framework
npx storybook sandbox react
# Filter by builder
npx storybook sandbox vite
# Filter by specific template name
npx storybook sandbox "react-typescript"# Download template without Storybook setup
npx storybook sandbox react --no-init
# Manually initialize later
cd react-template
npx storybook@latest initInstall with Tessl CLI
npx tessl i tessl/npm-storybook--cli