Skip to content

Commit 5f349ed

Browse files
authored
chore: storybook-doc added (#5122)
1 parent 8d0a523 commit 5f349ed

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.storybook/README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,44 @@ export const WithVariant: Story = {
9393

9494
## Development Tips
9595

96+
## ComfyUI Storybook Guidelines
97+
98+
### Scope – When to Create Stories
99+
- **PrimeVue components**:
100+
No need to create stories. Just refer to the official PrimeVue documentation.
101+
- **Custom shared components (design system components)**:
102+
Always create stories. These components are built in collaboration with designers, and Storybook serves as both documentation and a communication tool.
103+
- **Container components (logic-heavy)**:
104+
Do not create stories. Only the underlying pure UI components should be included in Storybook.
105+
106+
### Maintenance Philosophy
107+
- Stories are lightweight and generally stable.
108+
Once created, they rarely need updates unless:
109+
- The design changes
110+
- New props (e.g. size, color variants) are introduced
111+
- For existing usage patterns, simply copy real code examples into Storybook to create stories.
112+
113+
### File Placement
114+
- Keep `*.stories.ts` files at the **same level as the component** (similar to test files).
115+
- This makes it easier to check usage examples without navigating to another directory.
116+
117+
### Developer/Designer Workflow
118+
- **UI vs Container**: Separate pure UI components from container components.
119+
Only UI components should live in Storybook.
120+
- **Communication Tool**: Storybook is not just about code quality—it enables designers and developers to see:
121+
- Which props exist
122+
- What cases are covered
123+
- How variants (e.g. size, colors) look in isolation
124+
- **Example**:
125+
`PackActionButton.vue` wraps a PrimeVue button with additional logic.
126+
→ Only create a story for the base UI button, not for the wrapper.
127+
128+
### Suggested Workflow
129+
1. Use PrimeVue docs for standard components
130+
2. Use Storybook for **shared/custom components** that define our design system
131+
3. Keep story files alongside components
132+
4. When in doubt, focus on components reused across the app or those that need to be showcased to designers
133+
96134
### Best Practices
97135

98136
1. **Keep Stories Simple**: Each story should demonstrate one specific use case
@@ -135,6 +173,7 @@ export const WithLongText: Story = {
135173
- **`main.ts`**: Core Storybook configuration and Vite integration
136174
- **`preview.ts`**: Global decorators, parameters, and Vue app setup
137175
- **`manager.ts`**: Storybook UI customization (if needed)
176+
- **`preview-head.html`**: Injects custom HTML into the `<head>` of every Storybook iframe (used for global styles, fonts, or fixes for iframe-specific issues)
138177

139178
## Chromatic Visual Testing
140179

@@ -170,4 +209,4 @@ This Storybook setup includes:
170209
- PrimeVue component library integration
171210
- Proper alias resolution for `@/` imports
172211

173-
For component-specific examples, see the NodePreview stories in `src/components/node/`.
212+
For component-specific examples, see the NodePreview stories in `src/components/node/`.

0 commit comments

Comments
 (0)