React testimonial component

The simplest React testimonial component is a client component that renders one div and loads Vouchjar's embed script, which fills the div with your approved testimonials. Vouchjar also gives you a link that collects testimonials from customers, so you don't keep a testimonials array in your repo or redeploy each time a new one comes in.

Layout
Theme
Style
Embed code
<div data-vouchjar="your-wall" data-layout="carousel" data-theme="auto"></div>
<script src="https://vouchjar.com/embed.js" async></script>

Example quotes. Want to try the collection form as well? Use the homepage demo.

What you’re adding

The component renders a <div data-vouchjar="your-wall"> and makes sure https://vouchjar.com/embed.js is loaded. The script fetches your approved testimonials and renders them inside the div as a grid, a carousel or a single quote, in a shadow root that your app’s CSS can’t touch.

The testimonials themselves come from a collection link. Customers write a few lines, pick a star rating and can add a photo. Nothing shows until you approve it in your Vouchjar dashboard, and approving one doesn’t need a deploy.

Add it to a React app in five steps

1. Create a free wall

Sign up with your email. You don’t need a password or a card. The free plan gives you one wall and five approved testimonials, and your wall’s ID is in the embed code on the dashboard.

2. Collect and approve testimonials

Send the collection link to a few customers. Praise you already have on X or LinkedIn can go in through Import: paste the post, and Vouchjar reads the name and text for you to check. Tick Show on wall on the ones you want live.

3. Add the component

This version works in Next.js, Vite, Remix or any React setup. Save it as components/Vouchjar.jsx:

'use client';
import { useEffect } from 'react';

export default function Vouchjar({ wall, layout = 'grid' }) {
  useEffect(() => {
    if (window.Vouchjar) return window.Vouchjar.scan();
    const s = document.createElement('script');
    s.src = 'https://vouchjar.com/embed.js';
    s.async = true;
    document.body.appendChild(s);
  }, [wall]);
  return <div data-vouchjar={wall} data-layout={layout} />;
}

'use client' marks it as a Client Component for the Next.js App Router. Other React setups ignore the line.

4. Or use next/script in the App Router

In Next.js you can let next/script handle loading instead. Its onReady callback runs once the script has loaded and again every time the component mounts, which covers client-side navigation. onReady only works in Client Components, so keep the directive:

'use client';
import Script from 'next/script';

export default function Vouchjar({ wall, layout = 'grid', theme }) {
  return (
    <>
      <div data-vouchjar={wall} data-layout={layout} data-theme={theme} />
      <Script
        id="vouchjar"
        src="https://vouchjar.com/embed.js"
        strategy="lazyOnload"
        onReady={() => window.Vouchjar?.scan()}
      />
    </>
  );
}

lazyOnload waits for browser idle time, which is what the Next.js docs suggest for social widgets. Use the default afterInteractive if the wall sits near the top of the page. Leave out beforeInteractive: it belongs to scripts that must run before hydration, and it only works in the root layout.

5. Render it and deploy

In Next.js, you can render it from any page, Server Component pages included:

import Vouchjar from '@/components/Vouchjar';

export default function Page() {
  return <Vouchjar wall="your-wall" layout="carousel" />;
}

The widget API allows requests from any origin, so you can check it on localhost with next dev or vite before you deploy.

A few React details

With TypeScript, save the file as .tsx and declare the global once so window.Vouchjar type-checks: declare global { interface Window { Vouchjar?: { scan(): void } } }.

The widget mounts each div once. If a single component instance can change its wall prop, render it with key={wall} so React swaps in a fresh div.

The wall’s height isn’t known until the testimonials arrive, so the content below it can jump. A min-height on the wrapper, about the size of one row of cards, keeps that small.

Which layout to pass

LayoutPropGood for
Gridlayout="grid" (default)A testimonials route or a wall-of-love page
Carousellayout="carousel"A landing page section with a fixed height
Singlelayout="single"Beside a pricing table or a signup form

Your own component or a widget?

You can also write a testimonial component yourself, with a hard-coded array and full Tailwind styling. For some sites that’s the better choice:

Your own component and arrayVouchjar component
StylingAnything you can writeNeutral cards, light or dark
In server HTMLYesNo, loads in the browser
Getting testimonials inYou paste them into codeCustomers submit through a link, or you paste from X/LinkedIn
Adding a new oneEdit, commit, redeployApprove in the dashboard, live within a minute
CostYour timeFree for 5 testimonials, then $8/month

If design control or server-rendered text matters most, build your own. If collecting and approving testimonials is the chore, the widget handles that part. Building with Astro instead? See the Astro testimonials guide.

FAQ

Why does the wall disappear after a client-side navigation?
That happens when the script tag sits in a layout and only runs on the first page load. A div that mounts later never gets scanned. Both components on this page ask the widget to scan the page again on every mount, which fixes it.
Why is embed.js requested twice in development?
React Strict Mode runs effects twice in development, so the plain component can add the script tag twice. The second copy sees the first one and only rescans the page. Production builds run the effect once.
Can I style the cards with Tailwind or CSS Modules?
No. The widget renders inside a shadow root, so your classes can't reach the cards, and the widget's styles can't leak into your app. You can set data-theme to light, dark or auto, and style the wrapper around the div however you like.
Is there an npm package?
No. The component is about a dozen lines, so you copy it into your project and change it however you like. There's nothing extra to keep updated in package.json.
Are the testimonials in my server-rendered HTML?
No. The server sends an empty div and the testimonials load in the browser after hydration. If you need the quote text in the HTML your server sends, write those testimonials into your JSX yourself.
Collect your first testimonial free

Free for 5 testimonials. No card. Pro is $8/month.

Short version: React and Next.js install steps in the docs.

Updated October 16, 2026