storybook/docs/snippets/svelte/component-story-with-accessibility.js.mdx
2021-11-09 01:41:54 +00:00

36 lines
729 B
Plaintext

```js
// Button.stories.js
import Button from './Button.svelte';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/svelte/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Accessibility testing',
component: Button,
argTypes: {
backgroundColor: { control: 'color' },
},
};
const Template = (args) => ({
Component: Button,
props: args,
});
// This is an accessible story
export const Accessible = Template.bind({});
Accessible.args = {
primary: false,
label: 'Button',
};
// This is not
export const Inaccessible = Template.bind({});
Inaccessible.args = {
...Accessible.args,
backgroundColor: 'red',
};
```