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
_Note:_ In your story, be sure to include the `if:false` override otherwise the control will only show up if you have a `setName` arg and it is equal to `workflow`.
122
122
123
-
Want to load UI icons instead? Use the following variable import instead:
123
+
Want to load UI icons instead? Use the following variable import instead of the above:
124
124
125
125
```js
126
126
argTypes: {
@@ -205,6 +205,70 @@ label: {
205
205
},
206
206
```
207
207
208
+
### args
209
+
210
+
In a story, the args object contains all the default values for the component. These values will be used to render the component in the storybook preview. The values can be overridden by the user via the controls or by setting a custom args object in a specific story.
211
+
212
+
The default story should _almost_ always have any empty args object because it is, by nature, using all the default settings.
213
+
214
+
```js
215
+
exportconstDefault=Template.bind({});
216
+
Default.args= {};
217
+
```
218
+
219
+
Subsequent stories can override the default args object by setting a new value for the desired property. i.e.,
220
+
221
+
```js
222
+
exportconstExpress=Template.bind({});
223
+
Express.args= {
224
+
express:true
225
+
};
226
+
```
227
+
228
+
Try to focus stories on a single property or set of properties. This will make it easier for users to find the story they are looking for and will help in debugging issues.
229
+
230
+
#### customStorybookStyles
231
+
232
+
All stories are wrapped in a custom decorator that applies a few standard display properties to the preview.
233
+
234
+
```css
235
+
#root-inner {
236
+
position: relative;
237
+
gap:1rem;
238
+
padding:max(10px, 1rem);
239
+
}
240
+
```
241
+
242
+
If you need to override or add to these styles, you can do so by adding a `customStorybookStyles` property to your args object. This should be an object with CSS rules in the same `styleMap` format used by lit. i.e.,
243
+
244
+
```js
245
+
args: {
246
+
customStorybookStyles: {
247
+
display:"flex",
248
+
flexDirection:"column",
249
+
alignItems:"flex-start",
250
+
},
251
+
},
252
+
```
253
+
254
+
Leveraging an argType in your component that matches `staticColor` with allowed values of `white` or `black` will automatically set the background color of the preview to an appropriate value (white will use `rgb(15, 121, 125)`; black will use `rgb(181, 209, 211)`). If you need to override this value, you can do so by setting the `customStorybookStyles` property to an object with a `backgroundColor` property. i.e.,
255
+
256
+
```js
257
+
args: {
258
+
customStorybookStyles: {
259
+
backgroundColor:"rgb(238, 14, 189)",
260
+
},
261
+
},
262
+
```
263
+
264
+
Any settings added by the story will override these values. You can unset a value completely using undefined, i.e.:
265
+
266
+
```js
267
+
customStorybookStyles: {
268
+
padding:undefined,
269
+
},
270
+
```
271
+
208
272
## Templates
209
273
210
274
The goal of the template files is to create a definition for this component to enforce and demonstrate the allowed semantics and required classNames and settings to achieve the desired output (based on the user's selected controls).
@@ -240,14 +304,14 @@ All return values for Template functions should be outputting TemplateResults. S
@@ -339,142 +396,5 @@ Runs will generate a JUnit XML file with build results (`chromatic-build-{buildN
339
396
340
397
Running without publishing to Chromatic? Add the `--dry-run` flag. Need more information to debug a run? Try the `--diagnostics` flag (writes process context information to `chromatic-diagnostics.json`).
341
398
342
-
# Migration to Storybook 7.0(Draft)
343
-
344
-
## Updates
345
-
346
-
---
347
-
`*` Added support for handler actions with ```withActions``` on each stories which have action handlers.
348
-
349
-
Example:
350
-
351
-
```js
352
-
import globalThis from 'global';
353
-
+ import { withActions } from '@storybook/addon-actions/decorator';
0 commit comments