Marketing sectionsTestimonials
Searchastronomic.dev# Testimonials
To build your own testimonials layout: a section heading and one or more quotes, each with the person's name and role. For a ready layout, use TestimonialQuote or TestimonialGrid.
Static: no JavaScript.
## Usage
```astro
import Testimonials from "@astronomic-dev/ui/components/Testimonials.astro";
```
## Examples
### Slots
The section is a shell: the eyebrow, the heading and the text always show in that order, then the list of quotes in the default slot, one Testimonial in an <li> each. The shell sets the type and the gaps; the recipes lay out the quotes. TestimonialQuote and TestimonialGrid are recipes built on it.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import Testimonial from "@astronomic-dev/ui/components/Testimonial.astro";
import Testimonials from "@astronomic-dev/ui/components/Testimonials.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Star from "../../logos/astronomic-star.svg";
const heading = "What clients say";
// One level under the section heading: h2 gives h3.
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl px-6 py-16">
<Testimonials heading={heading} text="One quote from a client, with their name, role and company.">
<Badge slot="eyebrow">Clients</Badge>
<li class="grid min-w-0">
<Testimonial
title="Launched in three weeks"
quote="They shipped our new site in three weeks, and we changed the whole color scheme the day before launch."
name="Sample Person"
role="Head of brand"
company="Sample Co."
headingTag={tag}
>
<Star slot="logo" class="size-6 text-muted" aria-hidden="true" />
</Testimonial>
</li>
</Testimonials>
</div>
```
## Props
### Testimonials
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `string` | None | The section heading, in the title role in display type. Without it there is no section and no header: a plain <div> holds only the quotes. |
| `emphasis` | `boolean` | `false` | Turn one *phrase* in the heading into <em>: exactly two asterisks around text with no space inside, as in "Built for *the long run*". Any other asterisks show as typed. Off by default, so the heading shows as typed. How the <em> looks is the theme's. |
| `mark` | `string` | None | A short mark after the heading, such as "(12)" or "©2026", in small muted type. It sits beside the heading, outside it, so the heading's name stays plain. Shown only with a heading. |
| `markLabel` | `string` | None | What the mark says to a screen reader, such as "12 projects": the mark is then hidden from screen readers and this is read in its place. Without it, the mark is read as written. |
| `text` | `string` | None | One or two sentences under the heading, in the lead role, muted. Shown only with a heading. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. A quote's title sits one level under it. |
| `tone` | `"page" \| "inverse"` | `"page"` | inverse on the inverse surface (Panel tone="inverse"): the heading and lead in its colors and its focus ring; TestimonialQuote's name and byline too. Without it, the page's colors, as before. |
| `align` | `"start" \| "center"` | `"start"` | For recipes. The alignment of the header. |
| `list` | `boolean` | `true` | For recipes. The quotes sit in one <ul role="list">; false gives a plain <div>, for one quote (a one-item list is noise for a screen reader). |
| `contentClass` | `string` | None | For recipes. Classes for the row that holds the header and the quotes. |
| `headerClass` | `string` | None | For recipes. Classes for the header (the eyebrow, the heading and the text). |
| `listClass` | `string` | None | For recipes. Classes for the box that holds the quotes, such as its columns and its gap (the shell sets no gap). It sits inside the testimonials container, so its classes can query it (@3xl/testimonials:...). |
| `class` | `string` | None | More classes for the root (the <section>, or the <div> without a heading), merged with cn(), so yours win on conflicts. The root is a named size container (inline-size containment): in a shrink-to-fit parent (inline-flex, a float, fit-content) it collapses, so give it a width there. |
| Slot | Description |
| --- | --- |
| `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. |
| `default` | The quotes: one <li> each, holding a Testimonial. The <ul> becomes a plain box only through a recipe's list={false}. |
Any other attribute goes on the <section>, or on the <div> without a heading.
## Accessibility
- With a heading, renders a <section> named by it, so it is a region landmark. The heading id is unique on the page.
- Without a heading, renders a plain <div>. Put your own heading above it.
- The quote is a <blockquote> in a <figure>, its caption the person. The avatar is hidden from a screen reader: the name is written next to it.
- A quote's title sits one level under the section heading (h2 gives h3). With no heading, it is an h3 unless you set itemHeadingTag.
- The quotes sit in one list (<ul role="list">), so a screen reader says how many there are. With no quotes the list is still there, empty: leave the section out when there are none.
Testimonials
FreeTo build your own testimonials layout: a section heading and one or more quotes, each with the person's name and role. For a ready layout, use TestimonialQuote or TestimonialGrid.
- File
- Testimonials.astro
- Group
- Marketing sections
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Slots
The section is a shell: the eyebrow, the heading and the text always show in that order, then the list of quotes in the default slot, one Testimonial in an <li> each. The shell sets the type and the gaps; the recipes lay out the quotes. TestimonialQuote and TestimonialGrid are recipes built on it.
This preview did not load.
main.astro
examples/testimonials/main.astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import Testimonial from "@astronomic-dev/ui/components/Testimonial.astro";
import Testimonials from "@astronomic-dev/ui/components/Testimonials.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
import Star from "../../logos/astronomic-star.svg";
const heading = "What clients say";
// One level under the section heading: h2 gives h3.
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl px-6 py-16">
<Testimonials heading={heading} text="One quote from a client, with their name, role and company.">
<Badge slot="eyebrow">Clients</Badge>
<li class="grid min-w-0">
<Testimonial
title="Launched in three weeks"
quote="They shipped our new site in three weeks, and we changed the whole color scheme the day before launch."
name="Sample Person"
role="Head of brand"
company="Sample Co."
headingTag={tag}
>
<Star slot="logo" class="size-6 text-muted" aria-hidden="true" />
</Testimonial>
</li>
</Testimonials>
</div>Minimal · Light