Skip to content

Commit

Permalink
docs(web-components): kitchen sink dynamic source example
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Jun 24, 2021
1 parent b66e3b2 commit d1039bc
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
import { html } from 'lit-html';

<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" />

0 comments on commit d1039bc

Please sign in to comment.