docs/_snippets/addon-actions-action-function.md
import type { Meta } from '@storybook/angular';
import { action } from 'storybook/actions';
import Button from './button.component';
const meta: Meta<Button> = {
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
};
export default meta;
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
import Button from './button.component';
const meta = preview.meta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import { action } from 'storybook/actions';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
</script>
import { action } from 'storybook/actions';
import Button from './Button.svelte';
export default {
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
};
import { action } from 'storybook/actions';
import Button from './Button';
export default {
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
};
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import { action } from 'storybook/actions';
import Button from './Button.svelte';
const { Story } = defineMeta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
</script>
// Replace your-framework with svelte-vite or sveltekit
import type { Meta } from '@storybook/your-framework';
import { action } from 'storybook/actions';
import Button from './Button.svelte';
const meta = {
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
} satisfies Meta<typeof Button>;
export default meta;
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Meta } from '@storybook/your-framework';
import { action } from 'storybook/actions';
import Button from './Button';
const meta = {
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
} satisfies Meta<typeof Button>;
export default meta;
import { action } from 'storybook/actions';
export default {
component: 'demo-button',
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
};
import type { Meta } from '@storybook/web-components-vite';
import { action } from 'storybook/actions';
const meta: Meta = {
component: 'demo-button',
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
};
export default meta;
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
const meta = preview.meta({
component: 'demo-button',
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
const meta = preview.meta({
component: 'demo-button',
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
import Button from './Button';
const meta = preview.meta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
import Button from './Button';
const meta = preview.meta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});
import { action } from 'storybook/actions';
import preview from '../.storybook/preview';
import Button from './Button.vue';
const meta = preview.meta({
component: Button,
args: {
// ๐ Create an action that appears when the onClick event is fired
onClick: action('on-click'),
},
});