storybook/docs/snippets/common/component-story-disable-controls-regex.ts.mdx
2022-11-30 20:25:47 +00:00

45 lines
977 B
Plaintext

```ts
// YourComponent.stories.ts|tsx
import { YourComponent } from './YourComponent';
// Replace your-framework with the name of your framework
import type { Meta, StoryObj } from '@storybook/your-framework';
const meta: Meta<typeof YourComponent> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/7.0/react/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'YourComponent',
component: YourComponent,
};
export default meta;
type Story = StoryObj<typeof YourComponent>;
export const ArrayInclude: Story = {
parameters: {
controls: { include: ['foo', 'bar'] },
},
};
export const RegexInclude: Story = {
parameters: {
controls: { include: /^hello*/ },
},
};
export const ArrayExclude: Story = {
parameters: {
controls: { exclude: ['foo', 'bar'] },
},
};
export const RegexExclude: Story = {
parameters: {
controls: { exclude: /^hello*/ },
},
};
```