-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(web-components): kitchen sink dynamic source example
- Loading branch information
1 parent
b66e3b2
commit a52d906
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
.../web-components-kitchen-sink/src/stories/addons/docs/dynamic-source.stories.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs'; | ||
|
||
<Meta | ||
title="Addons / Docs / Dynamic Source" | ||
component="sb-button" | ||
argTypes={{ | ||
size: { type: 'select', options: ['large', 'small'] }, | ||
label: { type: 'string' }, | ||
primary: { type: 'boolean' }, | ||
backgroundColor: { type: 'color', presetColors: ['white', 'transparent', 'blue'] }, | ||
}} | ||
/> | ||
|
||
# Dynamic Source | ||
|
||
Stories can use Dynamic Source to display the result of changes to controls. | ||
|
||
<Canvas withSource="open"> | ||
<Story | ||
name="Button" | ||
component="sb-button" | ||
args={{ | ||
size: 'large', | ||
label: 'Button', | ||
primary: false, | ||
backgroundColor: undefined, | ||
}} | ||
> | ||
{(args) => html` | ||
<sb-button | ||
?primary="${args.primary}" | ||
.size="${args.size}" | ||
.label="${args.label}" | ||
.backgroundColor="${args.backgroundColor}" | ||
> | ||
</sb-button> | ||
`} | ||
</Story> | ||
</Canvas> | ||
|
||
<ArgsTable story="Button" /> |