Vanilla
It's available as
npm package
.Or via a CDN:
The vanilla bundle is based on the React version and exported as Universal Module Definition (UMD).
Since the bundle doesn't include the dependencies, we recommend loading them from a CDN:
or even better, you can combine all the things in a single request:
You can save some bytes if you use
preact
instead of React:After that,
microlink
will be available in the global scope.We recommend calling the `microlink` method before the DOM finishes loading.
The vanilla interface is pretty simliar to jQuery/Zepto: You need to provide a CSS selector as the target element you want to convert into a preview.
You can pass any Microlink API query parameter as an object property, e.g., size.
The API parameters passed there will be attached for all the links.
If you want to pass specific API Parameters just for some cases, you can pass them as
data attributes
You can pass objects, arrays, booleans or even JSON structures as data attributes.
Although it's shipped with default styles, you can customize it using
CSS variables
or CSS classes.