storybook/docs/snippets/angular/component-story-highlight-addon.ts.mdx

35 lines
907 B
Plaintext

```ts
// Card.stories.ts
import { componentWrapperDecorator } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { useChannel } from '@storybook/preview-api';
import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight';
import { Card } from './card.component';
const meta: Meta<Card> = {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Card',
component: Card,
};
export default meta;
type Story = StoryObj<Card>;
export const Default: Story = (args) => ({
template: '<app-card></app-card>',
decorators: [
componentWrapperDecorator((story) => {
const emit = useChannel({});
emit(HIGHLIGHT, {
elements: ['.title', '.subtitle'],
});
return story;
}),
],
});
```