mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
25 lines
468 B
Plaintext
25 lines
468 B
Plaintext
```js
|
|
// MyComponent.stories.js|jsx
|
|
|
|
import { useChannel } from '@storybook/preview-api';
|
|
import { HIGHLIGHT } from '@storybook/addon-highlight';
|
|
|
|
import { MyComponent } from './MyComponent';
|
|
|
|
export default {
|
|
component: MyComponent,
|
|
};
|
|
|
|
export const Highlighted = {
|
|
decorators: [
|
|
(storyFn) => {
|
|
const emit = useChannel({});
|
|
emit(HIGHLIGHT, {
|
|
elements: ['h2', 'a', '.storybook-button'],
|
|
});
|
|
return storyFn();
|
|
},
|
|
],
|
|
};
|
|
```
|