一键导入
create-story
Guide for creating Storybook stories for Ion Design System components
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for creating Storybook stories for Ion Design System components
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Guides creating new components for the Ion Design System. Use this skill whenever the user asks to create, add, or build a new Ion component, new DS component, or new design system component. This skill MUST be used even if the user just says "create a component" or "add a new component" without being explicit — if the context is the Ion repo, always invoke this skill. It enforces that existing Ion components are reused inside new ones instead of native HTML elements.
Guides cherry-picking commits from the main branch (Angular v21) to support/v19 or support/v8 in the Ion Design System. Use this skill whenever the user mentions cherry-pick, backport, porting a fix or feature to v19/v8/support branches, propagating changes between branches, or needs to apply a commit from main to an older branch.
Step-by-step guide to create a new Ion Design System component with all required files
Guide for writing comprehensive tests for Ion Design System components using Jest + Angular Testing Library
基于 SOC 职业分类
| name | create-story |
| description | Guide for creating Storybook stories for Ion Design System components |
Follow this guide to create a Storybook story for an Ion component.
Read the component's .component.ts to understand all inputs, outputs, and variants.
Create projects/ion/src/stories/<component-name>.stories.ts:
import type { Meta, StoryObj } from '@storybook/angular';
import { Ion<ComponentName>Component } from '../lib/<component-name>/<component-name>.component';
const meta: Meta<Ion<ComponentName>Component> = {
title: 'Components/<ComponentName>',
component: Ion<ComponentName>Component,
tags: ['autodocs'],
argTypes: {
// Map outputs to Storybook actions
ionOnClick: { action: 'clicked' },
// Configure controls for specific inputs
type: {
control: { type: 'select' },
options: ['primary', 'secondary', 'ghost', 'dashed'],
},
size: {
control: { type: 'select' },
options: ['sm', 'md', 'lg', 'xl'],
},
},
};
export default meta;
Create a story for each meaningful state of the component:
export const Default: StoryObj<Ion<ComponentName>Component> = {
args: {
label: 'Default Button',
type: 'primary',
size: 'md',
},
};
export const Disabled: StoryObj<Ion<ComponentName>Component> = {
args: {
label: 'Disabled',
disabled: true,
},
};
export const Loading: StoryObj<Ion<ComponentName>Component> = {
args: {
label: 'Loading...',
loading: true,
},
};
If the component requires a service, provide it via applicationConfig:
import { MyService } from '../lib/my/my.service';
const meta: Meta<IonMyComponent> = {
// ...
render: (args) => ({
props: args,
applicationConfig: {
providers: [MyService],
},
}),
};
npm run storybook
Navigate to http://localhost:6006 and verify the component renders correctly in all story variants.