mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 20:51:07 +08:00
Changes from code review
This commit is contained in:
parent
3dcff54185
commit
25b68d4c43
@ -89,6 +89,24 @@ In particular, this would render a row with a modified description, a type displ
|
||||
💡 As with other Storybook properties (e.g., args, decorators), you can also override ArgTypes per story basis.
|
||||
</div>
|
||||
|
||||
#### Global `argTypes`
|
||||
|
||||
You can also define arg types at the global level; they will apply to every component's stories unless you overwrite them. To do so, export the `argTypes` key in your `preview.js`:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<CodeSnippets
|
||||
paths={[
|
||||
'common/button-story-project-args-theme.js.mdx',
|
||||
]}
|
||||
/>
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<div class="aside">
|
||||
💡 If you define a global arg type for a story that does not have that arg (e.g. if there is no corresponding global arg definition), then the arg type will have no effect.
|
||||
</div>
|
||||
|
||||
#### Using argTypes in addons
|
||||
|
||||
If you want to access the argTypes of the current component inside an addon, you can use the `useArgTypes` hook from the `@storybook/api` package:
|
||||
@ -101,4 +119,4 @@ If you want to access the argTypes of the current component inside an addon, you
|
||||
]}
|
||||
/>
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
@ -76,15 +76,15 @@ You can also define args at the component level; they will apply to all the comp
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
## Project args
|
||||
## Global args
|
||||
|
||||
You can also define args at the project level; they will apply to every component's stories unless you overwrite them. To do so, export the `args` key in your `preview.js`:
|
||||
You can also define args at the global level; they will apply to every component's stories unless you overwrite them. To do so, export the `args` key in your `preview.js`:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
<CodeSnippets
|
||||
paths={[
|
||||
'react/button-story-project-args-theme.js.mdx',
|
||||
'common/button-story-project-args-theme.js.mdx',
|
||||
]}
|
||||
/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user