You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ui-building-instructions.md
+15-9Lines changed: 15 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,14 @@
1
-
# Storybook 9 Essential Changes for Story Writing
1
+
# Writing User Interfaces
2
2
3
-
## Package Consolidation
3
+
When writing UI, prefer breaking larger components up into smaller parts.
4
4
5
-
### `Meta` and `StoryObj` imports
5
+
ALWAYS write a Storybook story for any component written. If editing a component, ensure appropriate changes have been made to stories for that component.
6
+
7
+
## Storybook 9 Essential Changes for Story Writing
8
+
9
+
### Package Consolidation
10
+
11
+
#### `Meta` and `StoryObj` imports
6
12
7
13
Update story imports to use the framework package:
8
14
@@ -11,7 +17,7 @@ Update story imports to use the framework package:
11
17
+ import { Meta, StoryObj } from '{{FRAMEWORK}}';
12
18
```
13
19
14
-
### Test utility imports
20
+
####Test utility imports
15
21
16
22
Update test imports to use `storybook/test` instead of `@storybook/test`
17
23
@@ -20,7 +26,7 @@ Update test imports to use `storybook/test` instead of `@storybook/test`
20
26
+ import { fn } from 'storybook/test';
21
27
```
22
28
23
-
## Global State Changes
29
+
###Global State Changes
24
30
25
31
The `globals` annotation has be renamed to `initialGlobals`:
26
32
@@ -32,7 +38,7 @@ export default {
32
38
};
33
39
```
34
40
35
-
## Autodocs Configuration
41
+
###Autodocs Configuration
36
42
37
43
Instead of `parameters.docs.autodocs` in main.js, use tags:
38
44
@@ -43,7 +49,7 @@ export default {
43
49
};
44
50
```
45
51
46
-
## Mocking imports in Storybook
52
+
###Mocking imports in Storybook
47
53
48
54
To mock imports in Storybook, use Storybook's mocking features. ALWAYS mock external dependencies to ensure stories render consistently.
49
55
@@ -80,13 +86,13 @@ export const LoggedIn: Story = {
80
86
81
87
Before doing this ensure you have mocked the import in the preview file.
-`afterEach` hook is now stable (was `experimental_afterEach`)
88
94
89
-
# Story Linking Agent Behavior
95
+
##Story Linking Agent Behavior
90
96
91
97
- ALWAYS provide story links after any changes to stories files, including changes to existing stories.
92
98
- After changing any UI components, ALWAYS search for related stories that might cover the changes you've made. If you find any, provide the story links to the user. THIS IS VERY IMPORTANT, as it allows the user to visually inspect the changes you've made. Even later in a session when changing UI components or stories that have already been linked to previously, YOU MUST PROVIDE THE LINKS AGAIN.
0 commit comments