Marketing sectionsTestimonialGrid
Searchastronomic.dev# TestimonialGrid
For several short quotes side by side, each on a card.
Static: no JavaScript.
## Usage
```astro
import TestimonialGrid from "@astronomic-dev/ui/components/TestimonialGrid.astro";
```
## Examples
### Three quotes
Each quote on a Card, in the lead role and the body face, under a title in display type, the cards in a row the same height. As many columns as fit, each at least 18rem: one on a phone, three on a wide page. The first has a title.
```astro
---
import TestimonialGrid from "@astronomic-dev/ui/components/TestimonialGrid.astro";
const quotes = [
{ title: "Launched in three weeks", quote: "They shipped our new site in three weeks, and our editors were trained before launch.", name: "Sample Person", role: "Head of brand", company: "Sample Co." },
{ quote: "Our team updates every page themselves now, and nothing breaks.", name: "Sample Editor", role: "Editor", company: "Sample Studio" },
{ quote: "Clear plans, real pages every Friday, and no surprises at launch.", name: "Sample Founder", role: "Founder", company: "Sample Group" },
];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<TestimonialGrid heading="What clients say" text="Three of the teams we worked with this year." items={quotes} />
</div>
```
### With the town, the job and the stars
Reviews for Tilth & Stone Landscapes: each byline is the town and the service (meta) in place of a role and a company, joined with a dot. Each card's head line is its stars and its source, from a function child that reads them from the card's own item.
```astro
---
import TestimonialGrid from "@astronomic-dev/ui/components/TestimonialGrid.astro";
const reviews = [
{ quote: "Our water bill in July was the lowest it has been since we bought the house. The front yard looks better than it ever did as lawn.", name: "Sarah G.", meta: ["Littleton", "Water-wise lawn conversion"], stars: 5, source: "Google · Aug 2026" },
{ quote: "They sent the plan to our HOA, answered their questions and got it approved. I did nothing but sign.", name: "Ben A.", meta: ["Centennial", "Landscape design and install"], stars: 5, source: "Yelp · Jul 2026" },
{ quote: "The walls are solid and the patio drains right. Took a day longer than quoted because of a hailstorm, which is fair.", name: "Priya N.", meta: ["Highlands Ranch", "Patios, paths and walls"], stars: 4, source: "Google · Jun 2026" },
];
type Review = (typeof reviews)[number];
const star = "M12 3.2l2.6 5.6 6.1.7-4.5 4.2 1.2 6-5.4-3-5.4 3 1.2-6-4.5-4.2 6.1-.7z";
---
<div class="mx-auto max-w-6xl px-6 py-16">
<TestimonialGrid heading="From your neighbors" text="Recent reviews, with the town and the job they were about." items={reviews}>
{({ stars, source }: Review) => (
<>
<span class="inline-flex gap-0.5" role="img" aria-label={`${stars} out of 5 stars`}>
{[0, 1, 2, 3, 4].map((n) => (
<svg viewBox="0 0 24 24" class="size-4" aria-hidden="true" fill={n < stars ? "currentColor" : "none"} stroke="currentColor" stroke-width={n < stars ? 0 : 1.6} stroke-linejoin="round">
<path d={star} />
</svg>
))}
</span>
<span class="ms-auto text-small text-muted">{source}</span>
</>
)}
</TestimonialGrid>
</div>
```
## Props
### TestimonialGrid
| 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. |
| `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. |
| `itemHeadingTag` | `"h2" \| "h3" \| "h4" \| "h5"` | `"h3"` | The title element when there is no heading. With a heading, titles sit one level under it. |
| `items` | `TestimonialItem[]` | None | Required. The quotes: { quote, name, role?, company?, meta?, avatar?, title? } (TestimonialItem, exported from TestimonialGrid.astro). Only these fields reach each quote, so a CMS entry's other fields never land on the page. An empty list renders an empty list: leave the section out when there are none. |
| `itemClass` | `string` | None | For recipes: each card (the Card box), merged after the kit's classes, such as its own fill. |
| Slot | Description |
| --- | --- |
| `default` | Each card's head line, above the title and the quote (Testimonial's head slot): stars, a source. A function child, {(item: YourItem, index) => …}, gets the card's item as you passed it, with all its fields (a rating, a source), so type it as your own item, and its index; plain content shows the same in every card. A card whose head renders empty has no head box. |
| `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. |
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.
TestimonialGrid
FreeFor several short quotes side by side, each on a card.
- File
- TestimonialGrid.astro
- Group
- Marketing sections
- Kind
- Static: no JavaScript
- Examples
- 2
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Three quotes
Each quote on a Card, in the lead role and the body face, under a title in display type, the cards in a row the same height. As many columns as fit, each at least 18rem: one on a phone, three on a wide page. The first has a title.
This preview did not load.
examples/testimonialgrid/main.astro
---
import TestimonialGrid from "@astronomic-dev/ui/components/TestimonialGrid.astro";
const quotes = [
{ title: "Launched in three weeks", quote: "They shipped our new site in three weeks, and our editors were trained before launch.", name: "Sample Person", role: "Head of brand", company: "Sample Co." },
{ quote: "Our team updates every page themselves now, and nothing breaks.", name: "Sample Editor", role: "Editor", company: "Sample Studio" },
{ quote: "Clear plans, real pages every Friday, and no surprises at launch.", name: "Sample Founder", role: "Founder", company: "Sample Group" },
];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<TestimonialGrid heading="What clients say" text="Three of the teams we worked with this year." items={quotes} />
</div>With the town, the job and the stars
Reviews for Tilth & Stone Landscapes: each byline is the town and the service (meta) in place of a role and a company, joined with a dot. Each card's head line is its stars and its source, from a function child that reads them from the card's own item.
This preview did not load.
examples/testimonialgrid/places.astro
---
import TestimonialGrid from "@astronomic-dev/ui/components/TestimonialGrid.astro";
const reviews = [
{ quote: "Our water bill in July was the lowest it has been since we bought the house. The front yard looks better than it ever did as lawn.", name: "Sarah G.", meta: ["Littleton", "Water-wise lawn conversion"], stars: 5, source: "Google · Aug 2026" },
{ quote: "They sent the plan to our HOA, answered their questions and got it approved. I did nothing but sign.", name: "Ben A.", meta: ["Centennial", "Landscape design and install"], stars: 5, source: "Yelp · Jul 2026" },
{ quote: "The walls are solid and the patio drains right. Took a day longer than quoted because of a hailstorm, which is fair.", name: "Priya N.", meta: ["Highlands Ranch", "Patios, paths and walls"], stars: 4, source: "Google · Jun 2026" },
];
type Review = (typeof reviews)[number];
const star = "M12 3.2l2.6 5.6 6.1.7-4.5 4.2 1.2 6-5.4-3-5.4 3 1.2-6-4.5-4.2 6.1-.7z";
---
<div class="mx-auto max-w-6xl px-6 py-16">
<TestimonialGrid heading="From your neighbors" text="Recent reviews, with the town and the job they were about." items={reviews}>
{({ stars, source }: Review) => (
<>
<span class="inline-flex gap-0.5" role="img" aria-label={`${stars} out of 5 stars`}>
{[0, 1, 2, 3, 4].map((n) => (
<svg viewBox="0 0 24 24" class="size-4" aria-hidden="true" fill={n < stars ? "currentColor" : "none"} stroke="currentColor" stroke-width={n < stars ? 0 : 1.6} stroke-linejoin="round">
<path d={star} />
</svg>
))}
</span>
<span class="ms-auto text-small text-muted">{source}</span>
</>
)}
</TestimonialGrid>
</div>