Interactive guided tour for new Storybook users learning how to write stories
npx @tessl/cli install tessl/npm-storybook--addon-onboarding@9.1.0Storybook Addon Onboarding provides an interactive guided tour for new Storybook users, helping them learn how to write stories and understand Storybook's core features. The addon automatically triggers when users visit the onboarding path and example Button stories are present, displaying a React-based tutorial interface.
npm install @storybook/addon-onboardingThis addon primarily works through automatic registration and does not require explicit imports in user code. The main export is:
// Main package (empty export - no functional API)
import onboarding from "@storybook/addon-onboarding";
// Result: {} (empty object)
// Import public constants and types
import {
STORYBOOK_ADDON_ONBOARDING_CHANNEL,
STORYBOOK_ADDON_ONBOARDING_STEPS
} from "@storybook/addon-onboarding/constants";
// Import types (TypeScript only)
import type { StepKey, StepDefinition } from "@storybook/addon-onboarding/Onboarding";For Storybook configuration:
// .storybook/main.js
export default {
addons: ["@storybook/addon-onboarding"]
};The addon is designed to work automatically without manual code integration. Simply add it to your Storybook configuration:
// .storybook/main.js
export default {
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-onboarding"
]
};The onboarding experience will automatically trigger when:
?path=/onboarding or ?onboarding=trueexample-button--primary)To manually trigger the onboarding:
http://localhost:6006/?path=/onboardingThe addon is built around several key components:
The addon automatically registers itself with the Storybook manager when appropriate conditions are met.
// Automatic registration - no manual API calls needed
// Registration happens in manager.tsx when:
// - onboarding query parameter is present OR path is '/onboarding'
// - example button stories are present
// - screen width >= 730pxEmpty default export - functionality is provided through addon registration.
export default {};Configures server-side telemetry and survey data collection.
/**
* Configures server-side channel for telemetry collection
* @param channel - Storybook communication channel
* @param options - Storybook options with core configuration
* @returns Promise resolving to the configured channel
*/
export const experimental_serverChannel: (
channel: Channel,
options: Options
) => Promise<Channel>;Legacy preset configuration for manager entry points.
/**
* Adds manager entry to Storybook configuration
* @param entry - Existing entries array (default: [])
* @returns Array with added manager entry
*/
function managerEntries(entry?: any[]): any[];The addon exports several constants that can be used by other addons or advanced integrations.
/**
* Channel identifier for addon communication and telemetry
*/
export const STORYBOOK_ADDON_ONBOARDING_CHANNEL: string;
/**
* Readonly array of onboarding step identifiers in sequence
*/
export const STORYBOOK_ADDON_ONBOARDING_STEPS: readonly [
"1:Intro",
"2:Controls",
"3:SaveFromControls",
"4:CreateStory",
"5:StoryCreated",
"6:IntentSurvey",
"7:FinishedOnboarding"
];The addon exports TypeScript types for advanced integrations and other addons.
/**
* Type representing valid onboarding step identifiers
*/
export type StepKey = (typeof STORYBOOK_ADDON_ONBOARDING_STEPS)[number];
/**
* Interface defining the structure of an onboarding step
*/
export interface StepDefinition {
key: StepKey;
hideNextButton?: boolean;
target?: string;
content: React.ReactNode;
placement?: 'top' | 'bottom' | 'left' | 'right' | 'center';
hideBackButton?: boolean;
styles?: {
tooltip?: React.CSSProperties;
tooltipContent?: React.CSSProperties;
tooltipTitle?: React.CSSProperties;
tooltipFooter?: React.CSSProperties;
buttonNext?: React.CSSProperties;
buttonBack?: React.CSSProperties;
buttonSkip?: React.CSSProperties;
};
}These types are imported from Storybook's internal APIs and used in the server channel configuration.
/**
* Event structure for telemetry and survey data
*/
interface Event {
type: 'telemetry' | 'survey';
step: string;
payload?: any;
}
/**
* Storybook communication channel interface
* Imported from 'storybook/internal/channels'
*/
interface Channel {
on(eventName: string, handler: (data: any) => void): () => void;
emit(eventName: string, data: any): void;
off(eventName: string, handler?: (data: any) => void): void;
}
/**
* Storybook configuration options interface
* Imported from 'storybook/internal/types'
*/
interface Options {
presets: {
apply<T>(name: string, defaultValue: T): Promise<T>;
};
}
/**
* Core configuration interface for telemetry settings
* Imported from 'storybook/internal/types'
*/
interface CoreConfig {
disableTelemetry?: boolean;
}The addon has smart activation logic and only loads when:
/onboarding OR query parameter onboarding=trueexample-button--primary)When these conditions aren't met, the addon will:
This addon is designed as a one-time educational experience. Once users complete the onboarding, they can remove it:
npm uninstall @storybook/addon-onboarding// .storybook/main.js
export default {
addons: [
// Remove this line:
// "@storybook/addon-onboarding"
]
};The addon collects anonymous usage data to improve the onboarding experience:
All telemetry can be disabled through Storybook's core configuration:
// .storybook/main.js
export default {
core: {
disableTelemetry: true
}
};The addon requires these peer dependencies:
storybook (workspace version)Internal dependencies include:
react and react-dom for UI componentsreact-joyride for guided tour functionality@neoconfetti/react for celebration animations@storybook/icons for consistent iconography