Astro testimonials section

For an Astro testimonials section, make a small .astro component with one div and Vouchjar's embed script marked is:inline, then drop it into any page. Your customers send testimonials through a Vouchjar link, and the ones you approve show up on the live site without a rebuild.

Layout
Theme
Style
Embed code
<div data-vouchjar="your-wall" 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

A Vouchjar wall has a collection link and an embed. Customers open the link, write a few lines, pick a star rating and can add a photo. Nothing appears on your site until you approve it. The embed is a <div> plus a <script> tag that renders your approved testimonials as a grid, a carousel or a single quote.

Because the testimonials load in the browser, your Astro build doesn’t change when a new one comes in. That suits static sites that only redeploy when the code changes.

Add it to Astro in six steps

1. Create a free wall

Sign up with your email. You don’t need a password or a card. The free plan includes one wall and five approved testimonials. 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. If you have praise on X or LinkedIn already, paste the post into Import and check the name and text Vouchjar pulls out. Tick Show on wall on the ones you want live.

3. Create the component

Save this as src/components/Testimonials.astro:

---
interface Props {
  wall: string;
  layout?: 'grid' | 'carousel' | 'single';
  theme?: 'light' | 'dark' | 'auto';
}
const { wall, layout = 'grid', theme } = Astro.props;
---
<section class="testimonials">
  <h2>What customers say</h2>
  <div data-vouchjar={wall} data-layout={layout} data-theme={theme}></div>
</section>
<script is:inline src="https://vouchjar.com/embed.js" async></script>

<style>
  .testimonials { margin-block: 4rem; }
</style>

The is:inline directive keeps Astro from trying to process an external script. Astro would treat the tag as inline anyway because of the async attribute, but writing it out makes the intent clear. The scoped style only reaches the section and heading. The cards live in a shadow root.

4. Use it on a page

Import it in any page or layout:

---
import Testimonials from '../components/Testimonials.astro';
---
<Testimonials wall="your-wall" layout="carousel" />

In an .mdx file, import it the same way below the frontmatter and use the tag in your content. Inline scripts aren’t deduplicated, so using the component twice on one page prints the script twice. That’s harmless: the second copy finds the widget already loaded and only rescans the page.

5. Using the ClientRouter? Add one listener

If your layout has <ClientRouter /> from astro:transitions (it was called <ViewTransitions /> before Astro 5), add this once to that layout:

<script is:inline>
  document.addEventListener('astro:page-load', () => window.Vouchjar?.scan());
</script>

astro:page-load fires on the first load and after every navigation, so walls on the incoming page get mounted. Without client-side routing you can skip this step.

6. Build and check

Run astro dev and open the page. The widget API accepts requests from any origin, so it works on localhost too. Then build and deploy as usual.

Which layout suits the section

LayoutPropGood for
Gridlayout="grid" (default)A testimonials page or a long landing page
Carousellayout="carousel"A homepage section where height matters
Singlelayout="single"Next to a pricing table or a call to action

A content collection or a widget?

Astro is good at rendering your own data, so you could keep testimonials in a content collection (a JSON or YAML file) and map them into cards. A fair comparison:

Content collectionVouchjar widget
StylingFull controlNeutral cards, light or dark
In the built HTMLYesNo, loads in the browser
Getting testimonials inYou copy each one into a fileCustomers submit through a link, or you paste from X/LinkedIn
Adding a new oneEdit the file, rebuild, deployApprove in the dashboard, live within a minute
CostFreeFree for 5 testimonials, then $8/month

If you have a fixed set of quotes and want them in the static HTML, use a collection. If the work is getting new testimonials and keeping the section current, let customers submit through the link.

Using React islands or Next.js as well? The React testimonial component guide covers those.

FAQ

Do I need a client directive or a UI framework integration?
No. Directives like client:load are for React, Vue or Svelte components. This is plain HTML and one external script, so it works in any .astro file with no integration installed.
Why does the wall vanish after I navigate with the ClientRouter?
With client-side routing, Astro swaps the page without a full reload, so the new div hasn't been scanned. Add the astro:page-load snippet from step 5 to your layout and the widget mounts every wall after each navigation.
Do I have to rebuild the site when I approve a testimonial?
No. The testimonials load in the browser from Vouchjar, so a static build stays as it is. A newly approved testimonial appears within about a minute.
Can I style the cards with Tailwind or scoped styles?
Not the cards themselves. They render in a shadow root, which your styles can't reach. You can style the section around them however you like. For dark cards, set the theme prop to dark, or to auto to follow the visitor's system setting.
Will Astro bundle or optimise the script?
No. The is:inline directive tells Astro to output the tag exactly as written, so the browser loads embed.js from vouchjar.com with async. It's under 3 KB compressed and doesn't block rendering.
Collect your first testimonial free

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

Short version: Astro install steps in the docs.

Updated October 16, 2026