storybook/docs/snippets/react/component-story-highlight-addon.js.mdx
Norbert de Langen ed3a8ec642
step 4
2022-11-03 14:39:43 +01:00

28 lines
646 B
Plaintext

```js
// Card.stories.js|jsx
import React, { useEffect } from 'react';
import { useChannel } from '@storybook/preview-api';
import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight';
import { Card } form './Card';
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Card',
component: Card
};
export const Default = () => <Card />;
Default.decorators = [
(storyFn) => {
emit(HIGHLIGHT, {
elements: ['.title', '.subtitle'],
});
return storyFn();
},
];
```