Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sahil1711's avatar

Wanted to return an Iframe for embedding in Notion.

So i wanted to create iframe for a component which I have been creating to embed in notion. However the notion need an html page as a link for it qualify for embeddding the page. Here's the link as an example. https://kanbancast.com/api/render/board/arwn30IP3lx3. But i am still not able to embed this in notion. Here's my vue component code.

import 'kanbancast-components/dist/board-view.es.js';

import { defineProps } from 'vue';

const props = defineProps({
    apiKey: {
        type: String,
        required: true,
    },
});
</script>

<template>
        <board-view
            :containerColor="'#3949AB'"
            class="max-w-screen-2xl"
            :project-id="1"
            :api-key="props.apiKey"
            statuses=""/>
</template>

<style scoped>

</style>

In backend i just inertia render with apiKey as a query prop. Would appreciate some help , thanks !

0 likes
1 reply
LaryAI's avatar
Level 58

To embed your Vue component in Notion, you need to serve it as an HTML page. Notion requires a URL that points to an HTML page, which can then be embedded using an iframe. Here’s a step-by-step solution to achieve this:

  1. Create an HTML file that includes your Vue component:

    • You need to create an HTML file that will serve as the entry point for your Vue component.
  2. Set up a simple server to serve the HTML file:

    • You can use a simple Node.js server or any static file server to serve the HTML file.
  3. Embed the URL in Notion:

    • Use the URL of the served HTML file to embed it in Notion.

Here’s an example of how you can do this:

Step 1: Create an HTML file

Create a file named index.html and include your Vue component in it.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Embed Vue Component</title>
    <script src="https://unpkg.com/vue@next"></script>
    <script src="https://unpkg.com/kanbancast-components/dist/board-view.es.js"></script>
</head>
<body>
    <div id="app"></div>
    <script>
        const { createApp, defineProps } = Vue;

        const App = {
            template: `
                <board-view
                    :containerColor="'#3949AB'"
                    class="max-w-screen-2xl"
                    :project-id="1"
                    :api-key="apiKey"
                    statuses=""
                />
            `,
            setup() {
                const apiKey = new URLSearchParams(window.location.search).get('apiKey');
                return { apiKey };
            }
        };

        createApp(App).mount('#app');
    </script>
</body>
</html>

Step 2: Set up a simple server

You can use a simple Node.js server to serve the index.html file. Create a file named server.js:

const express = require('express');
const path = require('path');
const app = express();

app.use(express.static(path.join(__dirname, 'public')));

app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname, 'public', 'index.html'));
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`Server is running on port ${PORT}`);
});

Make sure you have the index.html file in a public directory.

Step 3: Run the server

Install the necessary dependencies and run the server:

npm install express
node server.js

Step 4: Embed the URL in Notion

Once your server is running, you can access your Vue component at http://localhost:3000/?apiKey=YOUR_API_KEY. Use this URL to embed the iframe in Notion.

<iframe src="http://localhost:3000/?apiKey=YOUR_API_KEY" width="600" height="400"></iframe>

Replace YOUR_API_KEY with the actual API key you want to use.

This should allow you to embed your Vue component in Notion successfully.

Please or to participate in this conversation.