storybook/docs/snippets/vue/component-story-highlight-addon.ts-4-9.mdx
2023-12-27 20:47:00 +00:00

31 lines
641 B
Plaintext

```ts
// MyComponent.stories.ts
import type { Meta, StoryObj } from '@storybook/vue3';
import { useChannel } from '@storybook/preview-api';
import { HIGHLIGHT } from '@storybook/addon-highlight';
import MyComponent from './MyComponent.vue';
const meta = {
component: MyComponent,
} satisfies Meta<typeof MyComponent>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Highlighted: Story = {
decorators: [
() => {
const emit = useChannel({});
emit(HIGHLIGHT, {
elements: ['h2', 'a', '.storybook-button'],
});
return {
template: '<story />',
};
},
],
};
```