Testimonial Voices
A centered quote on a light ground with a glowing seam between the quote and the byline, and two buttons that swap the speaker and the seam's color.
"use client"
import { useState, type CSSProperties } from "react"
import {
Byline,
BylineDescription,
BylineName,
} from "@/components/byline/byline"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import {
GlowSeam,
StandingSeam,
} from "@/components/glow/glow-seam"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "Testimonials",
role: "group",
label: "Testimonial",
show: "Show",
example: "'s quote",
} as const
const VOICES = [
{
short: "Nicole",
name: "Nicole Mann",
role: "Product designer",
quote: "The small details gave the page a rhythm I could build around.",
core: "oklch(0.3 0.1 20)",
edge: "oklch(0.45 0.13 15 / 0.9)",
bloom: "oklch(0.45 0.14 20 / 0.28)",
},
{
short: "Noah",
name: "Noah Reed",
role: "Frontend developer",
quote:
"A little light at the boundary was enough to bring the whole layout together.",
core: "oklch(0.32 0.07 235)",
edge: "oklch(0.45 0.09 230)",
bloom: "oklch(0.45 0.1 232 / 0.3)",
},
] as const
/** A centered quote on a light ground with a seam between the quote and the byline, and two buttons that swap the speaker. */
export default function TestimonialVoices01() {
const [voiceIndex, setVoiceIndex] = useState(0)
const voice = VOICES[voiceIndex]
return (
<div className="relative isolate flex min-h-[440px] w-full max-w-[606px] min-w-0 flex-col justify-center gap-9 overflow-hidden rounded-[16px] bg-background p-10 text-center text-foreground [--font-display:var(--font-serif)] max-[600px]:min-h-[400px] max-[600px]:rounded-[12px] max-[600px]:p-[28px_24px]">
<Eyebrow variant="mono">{COPY.eyebrow}</Eyebrow>
<div aria-live="polite" aria-atomic="true" className="grid gap-[30px]">
<blockquote className="font-display text-[clamp(30px,7cqw,42px)] leading-[1.18] tracking-[-0.035em] text-balance max-[300px]:text-[30px]">
<p>“{voice.quote}”</p>
</blockquote>
<GlowSeam
className="h-[1.2px] [&>div:first-of-type]:h-[1.2px] [&>div:last-of-type]:opacity-[0.8] [&>div:last-of-type]:mix-blend-normal"
style={
{
"--gs-core": voice.core,
"--gs-edge": voice.edge,
"--gs-bloom": voice.bloom,
} as CSSProperties
}
/>
<Byline className="gap-y-1.5">
<BylineName className="text-sm/[1.6] font-normal">
{voice.name}
</BylineName>
<BylineDescription className="text-[11px]/[1.7]">
{voice.role}
</BylineDescription>
</Byline>
</div>
<ToggleGroup
variant="outline"
aria-label={COPY.label}
className="flex-wrap justify-center gap-2.5"
value={[VOICES[voiceIndex].short]}
onValueChange={(next) => {
const index = VOICES.findIndex((option) => option.short === next[0])
if (index >= 0) setVoiceIndex(index)
}}
>
{VOICES.map((option, index) => (
<ToggleGroupItem
key={option.short}
value={option.short}
className="relative h-auto min-h-10 rounded-[6px] border border-border bg-transparent py-2.5 pr-5 pl-[26px] text-xs/normal text-foreground aria-pressed:bg-card"
aria-label={`${COPY.show} ${option.short}${COPY.example}`}
>
{voiceIndex === index && (
<StandingSeam
className="top-1.5 bottom-1.5 left-2.5 w-3 [&>span:last-of-type]:mix-blend-normal"
style={
{
"--ss-core": option.core,
"--ss-edge": option.edge,
"--ss-bloom": option.bloom,
} as CSSProperties
}
/>
)}
{option.short}
</ToggleGroupItem>
))}
</ToggleGroup>
</div>
)
}
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
type BylineSize = "md" | "sm"
type BylineState = { slot: "byline"; size: BylineSize }
type BylineAvatarState = { slot: "byline-avatar" }
/**
* A person's byline: an optional `BylineAvatar`, then `BylineName` with a
* `BylineDescription` under it, as a `div`. With an avatar it becomes two
* columns: the avatar spans both lines, 16px from the text. Under a quote,
* pass `render={<figcaption />}`; in a centered quote add `w-fit text-left` so it shrinks to fit
* and keeps its text left-aligned.
*
* At `size="md"` (the default) the name is 16px/24px semibold and the
* description 14px/20px muted, 2px apart; a 40px avatar matches the two
* lines. At `size="sm"` both lines are 12px/20px, the name in regular weight,
* the byline of a card footer.
*/
function Byline({
className,
size = "md",
render,
...props
}: useRender.ComponentProps<"div", BylineState> & {
/** The type size: `md` (the default) 16px over 14px, `sm` 12px over 12px for a card footer. */
size?: BylineSize
}) {
return useRender({
defaultTagName: "div",
render,
state: { slot: "byline", size },
props: mergeProps<"div">(
{
className: cn(
"group/byline grid items-center gap-x-4 gap-y-0.5 text-sm/5 has-data-[slot=byline-avatar]:grid-cols-[auto_1fr] data-[size=sm]:text-xs/5",
className
),
},
props
),
})
}
/**
* Holds the person's picture beside the name and description: a stock
* `Avatar`, an orb avatar or an image, 40px recommended. Use
* `render={<div />}` when the artwork has a block root.
*/
function BylineAvatar({
className,
render,
...props
}: useRender.ComponentProps<"span", BylineAvatarState>) {
return useRender({
defaultTagName: "span",
render,
state: { slot: "byline-avatar" },
props: mergeProps<"span">(
{ className: cn("row-span-2 flex", className) },
props
),
})
}
/** The person's name, 16px/24px semibold, held close to the line below; 12px regular in a `sm` byline. */
function BylineName({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-name"
className={cn(
"self-end text-base/6 font-semibold group-data-[size=sm]/byline:text-xs/5 group-data-[size=sm]/byline:font-normal",
className
)}
{...props}
/>
)
}
/**
* The second line under the name, such as a job title, a company, a handle
* or a date, in 14px/20px muted text; 12px in a `sm` byline.
*/
function BylineDescription({ className, ...props }: ComponentProps<"span">) {
return (
<span
data-slot="byline-description"
className={cn("self-start text-muted-foreground", className)}
{...props}
/>
)
}
export { Byline, BylineAvatar, BylineName, BylineDescription }
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const eyebrowVariants = cva("text-eyebrow", {
variants: {
/**
* `default` is a 14px/20px label. `icon` adds a row with a 16px icon
* and a 12px gap; put the icon first and give it `aria-hidden`.
* `mono` and `caps` are 12px/20px uppercase labels with 0.12em
* tracking, in the mono and inherited faces respectively.
*/
variant: {
default: "text-sm/5 font-medium text-eyebrow",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
},
defaultVariants: { variant: "default" },
})
/**
* A short label above a heading, rendered as a `<p>` at weight 500.
* The default is 14px/20px in the kit's eyebrow color. The surrounding
* layout controls the space to the heading. Use `className` to customize
* the typography or color, and `render` to change the element.
*/
function Eyebrow({
className,
variant = "default",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type * as React from "react"
import { cn } from "cn"
// Diegetic seams, two marks. GlowSeam is the horizontal section divider
// (rose); StandingSeam is the vertical line marking the active item (cool).
// Each follows its ground: a lit seam on dark, the same hue as ink on light.
/** One face of a seam: the bright line, its edges and the bloom around it. */
type SeamFace = { core: string; edge: string; bloom: string }
/**
* The named seam colors. Each has a `glow` face for dark grounds, a lit line
* at high lightness, and an `ink` face for light grounds, the same hue as a
* deeper ink. Rose is the Glow Seam's default and cyan the Standing Seam's.
*/
const SEAM_COLORS = {
rose: {
glow: {
core: "oklch(0.88 0.08 25)",
edge: "oklch(0.72 0.13 15 / 0.9)",
bloom: "oklch(0.68 0.14 20 / 0.55)",
},
ink: {
core: "oklch(0.3 0.1 20)",
edge: "oklch(0.45 0.13 15 / 0.9)",
bloom: "oklch(0.45 0.14 20 / 0.28)",
},
},
cyan: {
glow: {
core: "oklch(0.92 0.05 235)",
edge: "oklch(0.8 0.09 230)",
bloom: "oklch(0.7 0.1 232 / 0.55)",
},
ink: {
core: "oklch(0.32 0.07 235)",
edge: "oklch(0.45 0.09 230)",
bloom: "oklch(0.45 0.1 232 / 0.3)",
},
},
amber: {
glow: {
core: "oklch(0.91 0.063 78)",
edge: "oklch(0.77 0.14 78 / 0.9)",
bloom: "oklch(0.7 0.14 78 / 0.55)",
},
ink: {
core: "oklch(0.32 0.098 78)",
edge: "oklch(0.45 0.126 78 / 0.9)",
bloom: "oklch(0.45 0.14 78 / 0.28)",
},
},
coral: {
glow: {
core: "oklch(0.91 0.0675 36)",
edge: "oklch(0.77 0.15 36 / 0.9)",
bloom: "oklch(0.7 0.15 36 / 0.55)",
},
ink: {
core: "oklch(0.32 0.105 36)",
edge: "oklch(0.45 0.135 36 / 0.9)",
bloom: "oklch(0.45 0.15 36 / 0.28)",
},
},
ice: {
glow: {
core: "oklch(0.91 0.0405 255)",
edge: "oklch(0.77 0.09 255 / 0.9)",
bloom: "oklch(0.7 0.09 255 / 0.55)",
},
ink: {
core: "oklch(0.32 0.063 255)",
edge: "oklch(0.45 0.081 255 / 0.9)",
bloom: "oklch(0.45 0.09 255 / 0.28)",
},
},
violet: {
glow: {
core: "oklch(0.91 0.063 295)",
edge: "oklch(0.77 0.14 295 / 0.9)",
bloom: "oklch(0.7 0.14 295 / 0.55)",
},
ink: {
core: "oklch(0.32 0.098 295)",
edge: "oklch(0.45 0.126 295 / 0.9)",
bloom: "oklch(0.45 0.14 295 / 0.28)",
},
},
mint: {
glow: {
core: "oklch(0.91 0.054 165)",
edge: "oklch(0.77 0.12 165 / 0.9)",
bloom: "oklch(0.7 0.12 165 / 0.55)",
},
ink: {
core: "oklch(0.32 0.084 165)",
edge: "oklch(0.45 0.108 165 / 0.9)",
bloom: "oklch(0.45 0.12 165 / 0.28)",
},
},
pearl: {
glow: {
core: "oklch(0.91 0 0)",
edge: "oklch(0.77 0 0 / 0.9)",
bloom: "oklch(0.7 0 0 / 0.55)",
},
ink: {
core: "oklch(0.32 0 0)",
edge: "oklch(0.45 0 0 / 0.9)",
bloom: "oklch(0.45 0 0 / 0.28)",
},
},
} satisfies Record<string, { glow: SeamFace; ink: SeamFace }>
type SeamColor = keyof typeof SEAM_COLORS
/** `auto` follows the color scheme: ink in light, glow in dark. */
type SeamTone = "auto" | "glow" | "ink"
// The faces land in per-tone variables; the classes below pick one per
// scheme. For a color of your own, set `--gs-light-*` and `--gs-dark-*`
// inline, or set `--gs-core`, `--gs-edge` and `--gs-bloom` inline to force
// one face in both schemes.
function seamVars(prefix: "gs" | "ss", color: SeamColor, tone: SeamTone) {
const c = SEAM_COLORS[color]
const light = tone === "glow" ? c.glow : c.ink
const dark = tone === "ink" ? c.ink : c.glow
return {
[`--${prefix}-light-core`]: light.core,
[`--${prefix}-light-edge`]: light.edge,
[`--${prefix}-light-bloom`]: light.bloom,
[`--${prefix}-dark-core`]: dark.core,
[`--${prefix}-dark-edge`]: dark.edge,
[`--${prefix}-dark-bloom`]: dark.bloom,
} as React.CSSProperties
}
/**
* A thin horizontal divider between sections: a rose line, brightest in the
* middle and fading out at both ends, with a soft blurred bloom around it.
* In dark mode it glows; in light mode it is a deeper rose ink.
*
* It is decorative, hidden from assistive tech, and spans the width of its
* container.
*/
function GlowSeam({
color = "rose",
tone = "auto",
className,
style,
...props
}: React.ComponentProps<"div"> & {
/** The named color; `rose` by default. See `SEAM_COLORS`. */
color?: SeamColor
/** `auto` follows the scheme; `glow` or `ink` forces one face. */
tone?: SeamTone
}) {
return (
<div
aria-hidden="true"
data-slot="glow-seam"
data-color={color}
className={cn(
"pointer-events-none relative h-0.5",
"[--gs-bloom:var(--gs-light-bloom)] [--gs-core:var(--gs-light-core)] [--gs-edge:var(--gs-light-edge)]",
"dark:[--gs-bloom:var(--gs-dark-bloom)] dark:[--gs-core:var(--gs-dark-core)] dark:[--gs-edge:var(--gs-dark-edge)]",
className
)}
style={{ ...seamVars("gs", color, tone), ...style }}
{...props}
>
<div
className="absolute inset-x-[6%] top-0 h-[1.5px]"
style={{
background:
"linear-gradient(90deg, transparent, var(--gs-edge) 38%, var(--gs-core) 52%, var(--gs-edge) 66%, transparent)",
}}
/>
<div
className="absolute inset-x-[12%] -top-1.75 h-3.75 blur-[9px] dark:mix-blend-screen"
style={{
background:
"radial-gradient(50% 100% at 50% 50%, var(--gs-bloom), transparent 75%)",
}}
/>
</div>
)
}
/**
* A vertical line of cool blue light that marks the active item, such as the
* selected tab. Like `GlowSeam`, it glows in dark mode and is a deeper ink in
* light mode. It is decorative and hidden from assistive tech.
*
* It is absolutely positioned with no size of its own: place it with
* `className`, for example `inset-y-0 left-0 w-3.5`, inside a positioned
* item. Inside a tab trigger it shows only while that tab is active.
*/
function StandingSeam({
color = "cyan",
tone = "auto",
className,
style,
...props
}: React.ComponentProps<"span"> & {
/** The named color; `cyan` by default. See `SEAM_COLORS`. */
color?: SeamColor
/** `auto` follows the scheme; `glow` or `ink` forces one face. */
tone?: SeamTone
}) {
return (
<span
aria-hidden="true"
data-slot="standing-seam"
data-color={color}
className={cn(
// In a tab trigger it lights only the active one.
"pointer-events-none absolute in-data-[slot=tabs-trigger]:opacity-0 in-data-[slot=tabs-trigger]:in-data-active:opacity-100",
"[--ss-bloom:var(--ss-light-bloom)] [--ss-core:var(--ss-light-core)] [--ss-edge:var(--ss-light-edge)]",
"dark:[--ss-bloom:var(--ss-dark-bloom)] dark:[--ss-core:var(--ss-dark-core)] dark:[--ss-edge:var(--ss-dark-edge)]",
className
)}
style={{ ...seamVars("ss", color, tone), ...style }}
{...props}
>
<span
className="absolute inset-y-2 left-0 w-[1.5px]"
style={{
background:
"linear-gradient(180deg, transparent, var(--ss-edge) 30%, var(--ss-core) 50%, var(--ss-edge) 70%, transparent)",
}}
/>
<span
className="absolute inset-y-1 -left-1.5 w-3.5 blur-[7px] dark:mix-blend-screen"
style={{
background:
"radial-gradient(50% 60% at 50% 50%, var(--ss-bloom), transparent 78%)",
}}
/>
</span>
)
}
export { GlowSeam, StandingSeam, SEAM_COLORS }
export type { SeamColor, SeamTone }
Installation
pnpm dlx shadcn@latest add @01orbital/testimonial-voices-01npx shadcn@latest add @01orbital/testimonial-voices-01yarn dlx shadcn@latest add @01orbital/testimonial-voices-01bunx --bun shadcn@latest add @01orbital/testimonial-voices-01Make it yours
- Its words are in
COPYat the top ofcomponents/blocks/testimonials/testimonial-voices-01/index.tsx: change them there, not in the markup. VOICES, also at the top of the file, holds its lists and settings.- Its look comes from Glow Seam; each page lists the props that change it.
Built from
npm: @01orbital/font-geist-serif. The CLI installs it for you.
Built from these parts. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.
Last updated on