mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 09:22:09 +08:00
24 lines
511 B
Plaintext
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();
|
|
},
|
|
],
|
|
};
|
|
```
|