All posts
How to Add a Feedback Widget to Next.js, React, and Vue (Step-by-Step)
·6 min read

How to Add a Feedback Widget to Next.js, React, and Vue (Step-by-Step)

A practical, framework-specific guide to adding a customer feedback widget to your Next.js, React, or Vue application in under 2 minutes.

Alexis Bouchez

Adding a feedback widget to your web app should take minutes, not hours. This guide covers the exact steps for Next.js, React, and Vue — with code snippets you can copy and paste.

Before You Start

You'll need a Palmframe account and a project. Sign up at palmframe.com, create a project, and copy your project ID. That's all the setup required.

Next.js (App Router)

Next.js with the App Router requires a client component for web components. Create a simple wrapper:

// components/feedback-widget.tsx
'use client'

import 'https://cdn.palmframe.com/embed.js'

export default function FeedbackWidget() {
  return <palmframe-widget project="your-project-id" />
}

Or skip the npm package entirely and use the script tag approach in your root layout:

// app/layout.tsx
export default function RootLayout({ children }) {
  return (
    <html>
      <head>
        <script src="https://cdn.palmframe.com/embed.js" async />
      </head>
      <body>
        {children}
        <palmframe-widget project="your-project-id" />
      </body>
    </html>
  )
}

The script tag approach is simpler and works without any client component wrapper. The widget loads asynchronously, so it won't block your page render.

Next.js Pages Router

For the Pages Router, add the script and widget to _app.tsx:

// pages/_app.tsx
import Script from 'next/script'

export default function App({ Component, pageProps }) {
  return (
    <>
      <Script src="https://cdn.palmframe.com/embed.js" strategy="afterInteractive" />
      <Component {...pageProps} />
      <palmframe-widget project="your-project-id" />
    </>
  )
}

React (Vite, Create React App)

For a standard React app, add the script tag to your index.html and the widget to your App component:

<!-- index.html -->
<script src="https://cdn.palmframe.com/embed.js" async></script>
// App.tsx
export default function App() {
  return (
    <div>
      {/* Your app content */}
      <palmframe-widget project="your-project-id" />
    </div>
  )
}

That's it. The widget is a standard web component — it works in any React app without additional dependencies or configuration.

Vue 3

Vue 3 works the same way. Add the script to your index.html and use the widget in your App component:

<!-- index.html -->
<script src="https://cdn.palmframe.com/embed.js" async></script>
<!-- App.vue -->
<template>
  <div>
    <!-- Your app content -->
    <palmframe-widget project="your-project-id" />
  </div>
</template>

If Vue warns about an unknown custom element, add the widget to your Vite config:

// vite.config.ts
import vue from '@vitejs/plugin-vue'

export default {
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag === 'palmframe-widget',
        },
      },
    }),
  ],
}

Nuxt 3

For Nuxt 3, create a client plugin and add the widget to your app layout:

// plugins/palmframe.client.ts
export default defineNuxtPlugin(() => {
  if (typeof window !== 'undefined') {
    const script = document.createElement('script')
    script.src = 'https://cdn.palmframe.com/embed.js'
    script.async = true
    document.head.appendChild(script)
  }
})
<!-- app.vue -->
<template>
  <NuxtLayout>
    <NuxtPage />
  </NuxtLayout>
  <palmframe-widget project="your-project-id" />
</template>

Svelte / SvelteKit

For SvelteKit, add the widget to your root layout:

<!-- src/routes/+layout.svelte -->
<svelte:head>
  <script src="https://cdn.palmframe.com/embed.js" async></script>
</svelte:head>

<slot />
<palmframe-widget project="your-project-id" />

Plain HTML

The simplest case — just two lines before :

<script src="https://cdn.palmframe.com/embed.js"></script>
<palmframe-widget project="your-project-id" />

Widget Configuration

The widget supports several attributes for customization:

  • project — your project ID or name (required)
  • position — widget position: bottom-right, bottom-left, top-right, or top-left
  • lang — language: en or fr
  • mode — set to test during development to avoid polluting production data

Example with all options:

<palmframe-widget
  project="your-project-id"
  position="bottom-left"
  lang="fr"
  mode="test"
/>

Testing Your Integration

After adding the widget:

  1. Open your site in the browser
  2. Look for the feedback button (bottom-right by default)
  3. Click it, submit a test feedback
  4. Check your Palmframe dashboard — the feedback should appear within seconds

If using mode="test", feedback will be marked as test data in your dashboard so you can filter it out later.

Common Issues

Widget doesn't appear: Check the browser console for errors. The most common cause is an incorrect project ID. Make sure you're using the project name or ID from your Palmframe dashboard.

Widget appears but feedback doesn't submit: Check that your project exists and hasn't been deleted. Test mode feedback works the same as live — it just gets a test flag.

Styling conflicts: The widget uses Shadow DOM, so your site's CSS won't affect it. If you're seeing layout issues, make sure nothing on your page is setting a global z-index higher than 10000.

Conclusion

Adding a feedback widget to any modern web framework takes less than 2 minutes. Copy the snippet for your framework, replace the project ID, and you're collecting feedback.

Want to start collecting feedback? Try Palmframe for free — takes 2 minutes to set up.