storybook/code/renderers/html/template/cli/js/Button.stories.js

53 lines
1.3 KiB
JavaScript

import { createButton } from './Button';
// More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
export default {
title: 'Example/Button',
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/html/writing-docs/docs-page
tags: ['docsPage'],
// More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
render: ({ label, ...args }) => {
// You can either use a function to create DOM elements or use a plain html string!
// return `<div>${label}</div>`;
return createButton({ label, ...args });
},
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
argTypes: {
backgroundColor: { control: 'color' },
label: { control: 'text' },
onClick: { action: 'onClick' },
primary: { control: 'boolean' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
};
export const Primary = {
args: {
primary: true,
label: 'Button',
},
};
export const Secondary = {
args: {
label: 'Button',
},
};
export const Large = {
args: {
size: 'large',
label: 'Button',
},
};
export const Small = {
args: {
size: 'small',
label: 'Button',
},
};