storybook/docs/snippets/web-components/addon-highlight-reset.js.mdx
2023-08-18 16:04:04 +01:00

24 lines
511 B
Plaintext

```js
// MyComponent.stories.js
import { useChannel } from '@storybook/preview-api';
import { HIGHLIGHT, RESET_HIGHLIGHT } from '@storybook/addon-highlight';
export default {
component: 'my-component',
};
export const ResetHighlight = {
decorators: [
(story) => {
const emit = useChannel({});
emit(RESET_HIGHLIGHT); //👈 Remove previously highlighted elements
emit(HIGHLIGHT, {
elements: ['header', 'section', 'footer'],
});
return story();
},
],
};
```