https://github.com/jhta/storybook-external-links
Decorator to add external links to storybook components after DOM rendering.
https://github.com/jhta/storybook-external-links
external-links scripting storybook
Last synced: about 1 year ago
JSON representation
Decorator to add external links to storybook components after DOM rendering.
- Host: GitHub
- URL: https://github.com/jhta/storybook-external-links
- Owner: jhta
- Created: 2019-08-26T12:07:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-12-12T14:54:13.000Z (over 5 years ago)
- Last Synced: 2025-04-01T15:49:09.270Z (over 1 year ago)
- Topics: external-links, scripting, storybook
- Language: JavaScript
- Size: 2.93 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Storybook External Links
Decorator to add external links to storybook components after DOM rendering.
## Install
```
npm install storybook-external-links
```
## How to use it?
### React
```js
import withExternalLinks from 'storybook-external-links'
```
### Vue
```js
import withExternalLinks from 'storybook-external-links/vue'
```
### Use
```js
const url = 'https://widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js'
// script tag arguments - optional
const options = {
async: true,
}
const externalLinkDecorator = withExternalLinks(url, options)
storiesOf('Button')
.addDecorator(externalLinkDecorator)
.add(myStory)
```
### Result after story mounting:
```html
```