# Embed: SDK

## Table of Contents

- [Quick start](#quick-start)
    - [React](#react)
    - [Vue](#vue)
    - [Vanilla / CDN](#vanilla--cdn)
- [Card or iframe — your call](#card-or-iframe--your-call)
- [Everything else is a prop](#everything-else-is-a-prop)
- [Choose between the Embed SDK and the other approaches](#choose-between-the-embed-sdk-and-the-other-approaches)
- [Next step](#next-step)

---

> **The legacy Microlink Embed SDK is no longer maintained.** It keeps working and you can still use it, but it won't receive further updates. The [Microlink SDK](https://microlink.io/integrations/sdk) — the [microlink.io](https://microlink.io/docs/sdk/getting-started/overview) package — is the way to consume the Microlink API going forward, and the [link preview](https://microlink.io/link-preview) page covers the component.

The Embed SDK is the fastest way to embed any URL: drop one component into your markup, pass a `url`, and get a live preview. It handles the API call, lazy-loading, the iframe-vs-card choice, and CSS theming.

Pick the Embed SDK when you want something rendered today with zero markup decisions. If you would rather render previews yourself, see [metadata API with custom HTML/CSS](https://microlink.io/docs/guides/embed/metadata-api). If you only need the provider's native player, see [iframe parameter](https://microlink.io/docs/guides/embed/iframe).

## Quick start

#### React

```bash
npminstall@microlink/reactstyled-components
```

```jsx
importMicrolinkfrom'@microlink/react'

<Microlinkurl='https://stripe.com'/>
```

#### Vue

```bash
npminstall@microlink/vue
```

```
<template>

<Microlinkurl="https://www.youtube.com/watch?v=9P6rdqiybaw"/>

</template>

<script>

import{Microlink}from'@microlink/vue'

exportdefault{components:{Microlink}}

</script>
```

#### Vanilla / CDN

```html
<scriptsrc="https://cdn.jsdelivr.net/combine/npm/react@16/umd/react.production.min.js,npm/react-dom@16/umd/react-dom.production.min.js,npm/react-is@16/umd/react-is.production.min.js,npm/styled-components@5/dist/styled-components.min.js,npm/@microlink/mql@latest/dist/mql.min.js,npm/@microlink/vanilla@5/dist/microlink.min.js"></script>

<aclass="link-preview"href="https://www.youtube.com/watch?v=9P6rdqiybaw"></a>

<script>

document.addEventListener('DOMContentLoaded',()=>{

microlink('.link-preview',{size:'large'})

})

</script>
```

The vanilla integration is selector-driven — pass any CSS selector and the Embed SDK replaces matching elements with previews.

The React, Vue, and vanilla integrations share the same props and CSS hooks; see the [link preview component](https://microlink.io/link-preview) page for all three.

## Card or iframe — your call

The single embed-relevant decision the Embed SDK adds is the `media` prop. Toggle it to switch between a static rich card and the provider's interactive iframe:

```jsx
// Static card — cheaper to render, better for long-scrolling pages

<Microlinkurl='https://www.youtube.com/watch?v=9P6rdqiybaw'media='image'/>

// Real YouTube player

<Microlinkurl='https://www.youtube.com/watch?v=9P6rdqiybaw'media='iframe'/>
```

`media` also accepts an array describing a fallback cascade:

```jsx
<Microlink

url='...'

media={['iframe','video','audio','image','logo']}

/>
```

The Embed SDK picks the first field that exists in the response — so one component handles YouTube, Spotify, GitHub READMEs, and plain articles without branching.

## Everything else is a prop

Every Microlink API parameter works as an Embed SDK prop, and the Embed SDK adds a few of its own:

| Prop                                                                                                                        | What it does                                                                       |
| --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| `apiKey`                                                                                                                    | Authenticate requests for Pro features                                             |
| `lazy`                                                                                                                      | Defer the API call until the card is in view (default `true`)                      |
| `setData` / `fetchData`                                                                                                     | Skip the runtime fetch when you already have the metadata (SSR, build-time crawls) |
| `size`, `contrast`, `direction`                                                                                             | Visual layout knobs                                                                |
| Any [API parameter](https://microlink.io/docs/api/getting-started/overview) (`screenshot`, `iframe`, `palette`, `meta`,...) | Forwarded to the API call                                                          |

Styling goes through CSS variables, stable BEM classes, or a `styled-components` wrapper. The [link preview component](https://microlink.io/link-preview) page shows the props and styling hooks in action.

## Choose between the Embed SDK and the other approaches

| If you want                                                  | Use                                                                                                |
| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
| A drop-in component, no boilerplate                          | Embed SDK (this page)                                                                              |
| Pre-built layouts and AI prompts to match your design system | [Generate custom previews with AI](https://microlink.io/docs/guides/embed/custom-previews-with-ai) |
| Full control over markup, server-rendered HTML, no client JS | [Metadata API + custom HTML](https://microlink.io/docs/guides/embed/metadata-api)                  |
| Just the provider's native player or widget                  | [iframe parameter](https://microlink.io/docs/guides/embed/iframe)                                  |

You can mix them: use the Embed SDK for inline links inside posts and a custom HTML hero for the article header. They share the same underlying API.

## Next step

If you'd rather skip the Embed SDK and have your AI coding assistant generate previews styled to your project, see [generate custom previews with AI](https://microlink.io/docs/guides/embed/custom-previews-with-ai).