Review Request 2
Product-stage review request: the product stands lit on a stage and the buyer gives one star tap first (the micro-commitment); the same short review form then opens for every rating and hands the answers to onSubmit.
Use it in a prompt
Use forms/review-request-2 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/forms/review-request-2.tsx. - Import it and pass your copy and images (Props tab):
import { ReviewRequest2 } from "@/components/funneldna/forms/review-request-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/review-request-2/component.tsx 670 lines
// layout: spotlight-row
// Product-stage review request: the product stands lit on a stage and the buyer gives one star tap first (the micro-commitment); the same short review form then opens for every rating and hands the answers to onSubmit.
import React, { useEffect, useId, useRef, useState } from "react";
import { AlertCircle, Check, Clock, ImagePlus, Loader2, Star, X } from "lucide-react";
import { FX_HOST, Glow } from "../fx/fx";
export type ReviewRequest2Values = {
rating: number; // 1-5
ratingLabel: string;
headline: string;
review: string;
photo: File | null; // local file only; the builder decides where it goes
name: string;
permission: boolean; // may the review and photo be shared publicly
};
export type ReviewRequest2Copy = {
headline: string; // {product}
headlineMark: string; // phrase inside the headline that gets the marker stroke; "" for none
lead: string;
aside: string; // italic aside in the maker's voice; "" hides it
ratingLegend: string; // {product}
ratingPrompt: string;
ratingLabels: [string, string, string, string, string];
ratingSay: string; // live label: {n}, {label}
starAria: string; // {n}, {label}
cardTitle: string; // {n}
headlineLabel: string;
headlinePlaceholder: string;
headlineError: string;
reviewLabel: string;
reviewHelp: string; // {product}
reviewPlaceholder: string;
counterLeft: string; // {left}
counterLeftOne: string;
counterDone: string;
reviewError: string; // {min}
photoLabel: string;
photoOptional: string;
photoDrop: string;
photoButton: string;
photoReplace: string;
photoNote: string; // {mb}
photoAlt: string;
removeAria: string;
typeError: string;
sizeError: string; // {mb}
nameLabel: string;
nameHelp: string;
namePlaceholder: string;
nameError: string;
permissionLabel: string;
button: string;
sending: string;
hintNoRating: string;
reassurance: string;
};
export type ReviewRequest2Props = {
productName?: string; // used in the headline, the rating legend and the review help
productImage?: string; // slot "product": transparent cut-out of the product
productAlt?: string;
copy?: Partial<ReviewRequest2Copy>;
minLength?: number; // characters needed in the review text
maxPhotoMB?: number;
submitting?: boolean; // shows the loading button while the builder sends
onSubmit?: (values: ReviewRequest2Values) => void;
state?: "default" | "hover" | "active" | "disabled" | "error";
className?: string;
};
type Photo = { file: File; url: string };
export function ReviewRequest2(props: ReviewRequest2Props) {
const {
productName = "order",
productImage,
productAlt = "",
copy,
minLength = 20,
maxPhotoMB = 10,
submitting = false,
onSubmit,
state = "default",
className,
} = props;
const c: ReviewRequest2Copy = { ...DEFAULT_COPY, ...copy };
const vars = { product: productName };
const uid = useId();
const id = (part: string) => uid + "-" + part;
const start = seedFor(state);
const [rating, setRating] = useState(start.rating);
const [preview, setPreview] = useState<number | null>(start.preview);
const [headline, setHeadline] = useState("");
const [review, setReview] = useState("");
const [photo, setPhoto] = useState<Photo | null>(null);
const [photoError, setPhotoError] = useState(start.photoError ? c.typeError : "");
const [dragging, setDragging] = useState(false);
const [name, setName] = useState("");
const [permission, setPermission] = useState(false);
const [submitted, setSubmitted] = useState(start.submitted);
const [nudge, setNudge] = useState(false);
const headlineRef = useRef<HTMLInputElement>(null);
const reviewRef = useRef<HTMLTextAreaElement>(null);
const nameRef = useRef<HTMLInputElement>(null);
const firstStarRef = useRef<HTMLInputElement>(null);
const photoRef = useRef<Photo | null>(null);
useEffect(() => {
const seed = seedFor(state);
setRating(seed.rating);
setPreview(seed.preview);
setSubmitted(seed.submitted);
setNudge(false);
setPhotoError(seed.photoError ? c.typeError : "");
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state]);
useEffect(() => {
photoRef.current = photo;
}, [photo]);
useEffect(
() => () => {
if (photoRef.current) URL.revokeObjectURL(photoRef.current.url);
},
[]
);
const disabled = state === "disabled";
const open = rating > 0;
const shown = disabled ? rating : preview ?? rating;
const labelOf = (n: number) => c.ratingLabels[n - 1] ?? "";
const left = Math.max(0, minLength - review.trim().length);
const headlineInvalid = submitted && headline.trim() === "";
const reviewInvalid = submitted && left > 0;
const nameInvalid = submitted && name.trim() === "";
const counter = left === 0 ? c.counterDone : left === 1 ? c.counterLeftOne : fill(c.counterLeft, { left });
function pick(n: number) {
if (disabled) return;
setRating(n);
setPreview(null);
setNudge(false);
}
function choosePhoto(file: File | undefined) {
if (!file || disabled) return;
if (!isPhoto(file)) {
setPhotoError(c.typeError);
return;
}
if (file.size > maxPhotoMB * 1024 * 1024) {
setPhotoError(fill(c.sizeError, { mb: maxPhotoMB }));
return;
}
if (photo) URL.revokeObjectURL(photo.url);
setPhoto({ file, url: URL.createObjectURL(file) });
setPhotoError("");
}
function removePhoto() {
if (photo) URL.revokeObjectURL(photo.url);
setPhoto(null);
setPhotoError("");
}
function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
if (disabled || submitting) return;
if (!open) {
setNudge(true);
firstStarRef.current?.focus();
return;
}
setSubmitted(true);
if (headline.trim() === "") {
headlineRef.current?.focus();
return;
}
if (left > 0) {
reviewRef.current?.focus();
return;
}
if (name.trim() === "") {
nameRef.current?.focus();
return;
}
onSubmit?.({
rating,
ratingLabel: labelOf(rating),
headline: headline.trim(),
review: review.trim(),
photo: photo ? photo.file : null,
name: name.trim(),
permission,
});
}
const ico = { className: "rr2-ico", size: 16, strokeWidth: 2.5, "aria-hidden": true } as const;
return (
<section
className={"cf-review-request-2" + (open ? " is-rated" : "") + (className ? " " + className : "")}
aria-labelledby={id("title")}
>
<style>{CSS}</style>
<form className="rr2-wrap" noValidate onSubmit={handleSubmit} aria-busy={submitting || undefined}>
<h2 className="rr2-title rr2-rise" id={id("title")}>
{marked(fill(c.headline, vars), c.headlineMark)}
</h2>
<p className="rr2-lead rr2-rise" style={rise(1)}>
{c.lead}
</p>
{c.aside ? (
<p className="rr2-aside rr2-rise" style={rise(1)}>
{c.aside}
</p>
) : null}
{productImage ? (
<div className="rr2-stage rr2-rise" style={{ ...FX_HOST, ...rise(2) }}>
<span className="rr2-light" style={{ ...FX_HOST, position: "absolute", inset: 0 }} aria-hidden="true">
<Glow />
</span>
<span className="rr2-plinth" aria-hidden="true" />
<div className="rr2-product">
<img src={productImage} alt={productAlt} width={640} height={640} decoding="async" />
</div>
</div>
) : null}
<fieldset className="rr2-rate rr2-rise" style={rise(3)} disabled={disabled}>
<legend className="rr2-sr">{fill(c.ratingLegend, vars)}</legend>
<div
className={
"rr2-stars" + (preview !== null && !disabled ? " is-preview" : "") + (nudge && !open ? " is-nudge" : "")
}
onMouseLeave={() => setPreview(null)}
>
{STARS.map((n) => (
<label
key={n}
className={"rr2-star" + (n <= shown ? " is-lit" : "") + (n === rating ? " is-picked" : "")}
style={{ "--i": n - 1 } as React.CSSProperties}
onMouseEnter={() => {
if (!disabled) setPreview(n);
}}
>
<input
ref={n === 1 ? firstStarRef : undefined}
className="rr2-sr"
type="radio"
name={id("rating")}
value={n}
checked={rating === n}
onChange={() => pick(n)}
aria-label={fill(c.starAria, { n, label: labelOf(n) })}
/>
<span className="rr2-star-face" aria-hidden="true">
<Star strokeWidth={2.5} />
</span>
</label>
))}
</div>
<p className={"rr2-say" + (shown ? "" : " is-empty")} aria-hidden="true">
{shown ? fill(c.ratingSay, { n: shown, label: labelOf(shown) }) : c.ratingPrompt}
</p>
<span className="rr2-sr" aria-live="polite">
{rating ? fill(c.ratingSay, { n: rating, label: labelOf(rating) }) : ""}
</span>
</fieldset>
<div className={"rr2-open" + (open ? " is-open" : "")} aria-hidden={open ? undefined : true}>
<div className="rr2-open-clip">
<div className="rr2-open-pad">
<div className="rr2-card">
<h3 className="rr2-card-title">{fill(c.cardTitle, { n: rating || 5 })}</h3>
<div className="rr2-field">
<label className="rr2-label" htmlFor={id("headline")}>
{c.headlineLabel}
</label>
<input
ref={headlineRef}
id={id("headline")}
className={"rr2-input" + (headlineInvalid ? " is-invalid" : "")}
type="text"
value={headline}
onChange={(event) => setHeadline(event.target.value)}
placeholder={c.headlinePlaceholder}
maxLength={90}
disabled={disabled}
aria-invalid={headlineInvalid || undefined}
aria-describedby={headlineInvalid ? id("headline-err") : undefined}
/>
{headlineInvalid ? (
<p className="rr2-err" id={id("headline-err")}>
<AlertCircle {...ico} />
{c.headlineError}
</p>
) : null}
</div>
<div className="rr2-field">
<label className="rr2-label" htmlFor={id("review")}>
{c.reviewLabel}
</label>
<p className="rr2-help" id={id("review-help")}>
{fill(c.reviewHelp, vars)}
</p>
<textarea
ref={reviewRef}
id={id("review")}
className={"rr2-input" + (reviewInvalid ? " is-invalid" : "")}
rows={5}
value={review}
onChange={(event) => setReview(event.target.value)}
placeholder={c.reviewPlaceholder}
disabled={disabled}
aria-invalid={reviewInvalid || undefined}
aria-describedby={[id("review-help"), id("review-count"), reviewInvalid ? id("review-err") : ""]
.filter(Boolean)
.join(" ")}
/>
<p className={"rr2-count" + (left === 0 ? " is-done" : "")} id={id("review-count")}>
{left === 0 ? <Check {...ico} /> : null}
{counter}
</p>
{reviewInvalid ? (
<p className="rr2-err" id={id("review-err")}>
<AlertCircle {...ico} />
{fill(c.reviewError, { min: minLength })}
</p>
) : null}
</div>
<div className="rr2-field">
<div className="rr2-label-row">
<span className="rr2-label" id={id("photo-label")}>
{c.photoLabel}
</span>
<span className="rr2-opt">{c.photoOptional}</span>
</div>
<div
className={"rr2-drop" + (dragging ? " is-drag" : "") + (photoError ? " is-invalid" : "")}
onDragOver={(event) => {
if (disabled) return;
event.preventDefault();
setDragging(true);
}}
onDragLeave={() => setDragging(false)}
onDrop={(event) => {
event.preventDefault();
setDragging(false);
choosePhoto(event.dataTransfer.files?.[0]);
}}
>
{photo ? (
<img className="rr2-thumb" src={photo.url} alt={c.photoAlt} width={56} height={56} />
) : (
<span className="rr2-drop-ico" aria-hidden="true">
<ImagePlus size={28} strokeWidth={2.5} />
</span>
)}
<div className="rr2-drop-copy">
<p className="rr2-drop-title">{photo ? photo.file.name : c.photoDrop}</p>
<p className="rr2-drop-note" id={id("photo-note")}>
{fill(c.photoNote, { mb: maxPhotoMB })}
</p>
</div>
<div className="rr2-drop-actions">
<input
id={id("photo")}
className="rr2-sr rr2-file"
type="file"
accept="image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif"
disabled={disabled}
aria-describedby={[id("photo-label"), id("photo-note"), photoError ? id("photo-err") : ""]
.filter(Boolean)
.join(" ")}
onChange={(event) => {
choosePhoto(event.target.files?.[0]);
event.target.value = "";
}}
/>
<label className="rr2-btn2" htmlFor={id("photo")}>
{photo ? c.photoReplace : c.photoButton}
</label>
{photo ? (
<button
type="button"
className="rr2-remove"
onClick={removePhoto}
disabled={disabled}
aria-label={c.removeAria}
>
<X size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
) : null}
</div>
</div>
{photoError ? (
<p className="rr2-err" id={id("photo-err")} role="alert">
<AlertCircle {...ico} />
{photoError}
</p>
) : null}
</div>
<div className="rr2-field">
<label className="rr2-label" htmlFor={id("name")}>
{c.nameLabel}
</label>
<p className="rr2-help" id={id("name-help")}>
{c.nameHelp}
</p>
<input
ref={nameRef}
id={id("name")}
className={"rr2-input" + (nameInvalid ? " is-invalid" : "")}
type="text"
autoComplete="name"
value={name}
onChange={(event) => setName(event.target.value)}
placeholder={c.namePlaceholder}
maxLength={60}
disabled={disabled}
aria-invalid={nameInvalid || undefined}
aria-describedby={id("name-help") + (nameInvalid ? " " + id("name-err") : "")}
/>
{nameInvalid ? (
<p className="rr2-err" id={id("name-err")}>
<AlertCircle {...ico} />
{c.nameError}
</p>
) : null}
</div>
<label className="rr2-check">
<input
className="rr2-sr"
type="checkbox"
checked={permission}
onChange={(event) => setPermission(event.target.checked)}
disabled={disabled}
/>
<span className="rr2-box" aria-hidden="true">
<Check size={16} strokeWidth={3} />
</span>
<span>{c.permissionLabel}</span>
</label>
</div>
</div>
</div>
</div>
<div className="rr2-act">
<button
className="rr2-btn"
type="submit"
disabled={disabled}
aria-disabled={submitting || undefined}
aria-describedby={id("hint")}
>
{submitting ? (
<>
<Loader2 className="rr2-spin" size={20} strokeWidth={2.5} aria-hidden="true" />
{c.sending}
</>
) : (
c.button
)}
</button>
<p className={"rr2-hint" + (nudge && !open ? " is-nudge" : "")} id={id("hint")} aria-live="polite">
{open ? <Clock {...ico} /> : <Star {...ico} />}
{open ? c.reassurance : c.hintNoRating}
</p>
</div>
</form>
</section>
);
}
export default ReviewRequest2;
const STARS = [1, 2, 3, 4, 5];
const ACCEPT = ["image/jpeg", "image/png", "image/webp", "image/heic", "image/heif"];
const DEFAULT_COPY: ReviewRequest2Copy = {
headline: "How's your {product} holding up?",
headlineMark: "holding up?",
lead: "Tap a star. The rest takes about a minute.",
aside: "(Honest beats polite. Two stars or five, you get the same space to say why.)",
ratingLegend: "Rate your {product}",
ratingPrompt: "Tap a star to rate it",
ratingLabels: ["not for me", "not great", "it's okay", "really good", "love it"],
ratingSay: "{n} of 5: {label}",
starAria: "{n} of 5: {label}",
cardTitle: "Tell the next buyer why it's a {n}",
headlineLabel: "Sum it up in one line",
headlinePlaceholder: "Better than I expected, and I use it every day",
headlineError: "Add a one-line summary so buyers can scan it.",
reviewLabel: "What should the next buyer know?",
reviewHelp: "What did you notice first? How do you use your {product} day to day?",
reviewPlaceholder: "It arrived well packed and I've used it every day since…",
counterLeft: "{left} more characters",
counterLeftOne: "1 more character",
counterDone: "Perfect, that's plenty.",
reviewError: "Write at least {min} characters so it helps someone decide.",
photoLabel: "Add a photo of it in use",
photoOptional: "Optional",
photoDrop: "Drop a photo here",
photoButton: "Choose a photo",
photoReplace: "Change photo",
photoNote: "JPG, PNG, WebP or HEIC, up to {mb} MB",
photoAlt: "Your photo",
removeAria: "Remove photo",
typeError: "That file isn't a photo. Choose a JPG, PNG, WebP or HEIC image.",
sizeError: "That photo is over {mb} MB. Try a smaller one.",
nameLabel: "Your name as it should appear",
nameHelp: "First name and last initial is perfect.",
namePlaceholder: "Dana R.",
nameError: "Add the name you'd like shown with your review.",
permissionLabel: "You can share my review and photo on your site and in emails.",
button: "Yes! Share my review",
sending: "Sending your review…",
hintNoRating: "Tap a star above to start your review.",
reassurance: "About a minute, start to finish.",
};
type Seed = { rating: number; preview: number | null; submitted: boolean; photoError: boolean };
function seedFor(state: ReviewRequest2Props["state"]): Seed {
if (state === "hover") return { rating: 0, preview: 4, submitted: false, photoError: false };
if (state === "active") return { rating: 5, preview: null, submitted: false, photoError: false };
if (state === "disabled") return { rating: 4, preview: null, submitted: false, photoError: false };
if (state === "error") return { rating: 4, preview: null, submitted: true, photoError: true };
return { rating: 0, preview: null, submitted: false, photoError: false };
}
function isPhoto(file: File) {
const type = file.type.toLowerCase();
return type ? ACCEPT.includes(type) : /\.(jpe?g|png|webp|heic|heif)$/i.test(file.name);
}
function fill(template: string, vars: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match: string, key: string) => (key in vars ? String(vars[key]) : match));
}
function marked(text: string, mark: string): React.ReactNode {
const at = mark ? text.indexOf(mark) : -1;
if (at < 0) return text;
return (
<>
{text.slice(0, at)}
<span className="rr2-mark">{mark}</span>
{text.slice(at + mark.length)}
</>
);
}
function rise(step: number): React.CSSProperties {
return { animationDelay: Math.min(step * 0.07, 0.28).toFixed(2) + "s" };
}
const S = ".cf-review-request-2";
const CSS = `
${S}{--rr2-star:var(--star-fill,var(--accent-fill,var(--accent)));--rr2-empty:color-mix(in oklch,var(--ink) 7%,var(--surface));--rr2-edge:color-mix(in oklch,var(--ink) 45%,var(--surface));--rr2-shadow:var(--shadow,oklch(0.22 0.03 260));--rr2-marker:color-mix(in oklch,var(--marker,#fae37c) 85%,transparent);--rr2-ring:oklch(from var(--field-focus,var(--accent)) l c h / .35);position:relative;overflow:hidden;box-sizing:border-box;color:var(--ink);font-family:var(--font-body);padding:clamp(8px,1.5vw,16px) clamp(4px,2vw,16px)}
${S} *,${S} *::before,${S} *::after{box-sizing:border-box}
${S} .rr2-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
${S} .rr2-wrap{max-width:46rem;margin:0 auto;text-align:center}
${S} .rr2-title{margin:0 0 16px;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;color:var(--ink);text-wrap:balance}
${S} .rr2-mark{background:linear-gradient(transparent 50%,var(--rr2-marker) 50%,var(--rr2-marker) 92%,transparent 92%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .06em;border-radius:.1em}
${S} .rr2-lead{margin:0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
${S} .rr2-aside{margin:12px auto 0;max-width:36rem;font-size:1.0625rem;line-height:1.5;font-style:italic;color:var(--muted);text-wrap:pretty}
${S} .rr2-stage{position:relative;width:min(100%,34rem);height:clamp(220px,30vw,340px);margin:32px auto 0}
${S} .rr2-light{pointer-events:none;-webkit-mask-image:radial-gradient(closest-side at 50% 50%,black 45%,transparent 100%);mask-image:radial-gradient(closest-side at 50% 50%,black 45%,transparent 100%)}
${S} .rr2-plinth{position:absolute;left:50%;bottom:4%;width:76%;height:22%;transform:translateX(-50%);border-radius:50%;background:color-mix(in oklch,var(--ink) 5%,var(--surface));box-shadow:inset 0 1px 0 oklch(from var(--surface) calc(l + .04) c h / .6),inset 0 -3px 0 oklch(from var(--ink) l c h / .06)}
${S} .rr2-plinth::after{content:"";position:absolute;left:24%;right:24%;top:20%;height:48%;border-radius:50%;background:radial-gradient(closest-side,oklch(from var(--rr2-shadow) l c h / .34),oklch(from var(--rr2-shadow) l c h / 0))}
${S} .rr2-product{position:absolute;inset:0 0 14% 0;display:flex;align-items:flex-end;justify-content:center;pointer-events:none}
${S} .rr2-product img{display:block;height:90%;width:auto;max-width:100%;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 2px 3px oklch(from var(--rr2-shadow) l c h / .3)) drop-shadow(0 16px 14px oklch(from var(--rr2-shadow) l c h / .2));transition:transform .45s cubic-bezier(.2,.7,.2,1)}
${S}.is-rated .rr2-product img{transform:translateY(-6px)}
${S} .rr2-rate{margin:24px 0 0;padding:0;border:0;min-width:0}
${S} .rr2-stage + .rr2-rate{margin-top:8px}
${S} .rr2-stars{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;width:min(100%,27rem);margin:0 auto}
${S} .rr2-star{position:relative;display:block;min-height:72px;cursor:pointer;-webkit-tap-highlight-color:transparent}
${S} .rr2-star-face{display:grid;place-items:center;height:100%;min-height:72px;border-radius:12px;transition:transform .16s ease,background-color .16s ease}
${S} .rr2-star svg{display:block;width:clamp(44px,5vw,56px);height:clamp(44px,5vw,56px);fill:var(--rr2-empty);stroke:var(--rr2-edge);transition:fill .22s ease,stroke .22s ease;transition-delay:calc(var(--i,0) * 45ms)}
${S} .rr2-star.is-lit svg{fill:var(--rr2-star);stroke:oklch(from var(--rr2-star) calc(l - .12) c h)}
${S} .rr2-stars.is-preview .rr2-star svg{transition-delay:0s}
${S} .rr2-star.is-picked svg{animation:rr2-pop .3s cubic-bezier(.2,.7,.2,1) both}
${S} .rr2-stars.is-nudge .rr2-star svg{stroke:var(--rr2-star);animation:rr2-pop .3s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0) * 60ms)}
${S} .rr2-star input:focus-visible + .rr2-star-face{outline:3px solid var(--field-focus,var(--accent));outline-offset:0}
@media (hover:hover){${S} .rr2-rate:not(:disabled) .rr2-star:hover .rr2-star-face{transform:translateY(-3px);background-color:color-mix(in oklch,var(--ink) 4%,var(--surface))}}
${S} .rr2-rate:disabled .rr2-star{cursor:not-allowed}
${S} .rr2-rate:disabled .rr2-stars{opacity:.6}
${S} .rr2-say{margin:12px 0 0;min-height:1.875rem;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--ink);text-wrap:balance}
${S} .rr2-say.is-empty{font-family:var(--font-body);font-weight:500;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;letter-spacing:0;color:var(--muted)}
${S} .rr2-open{display:grid;grid-template-rows:0fr;visibility:hidden;transition:grid-template-rows .45s cubic-bezier(.2,.7,.2,1),visibility 0s linear .45s}
${S} .rr2-open.is-open{grid-template-rows:1fr;visibility:visible;transition:grid-template-rows .45s cubic-bezier(.2,.7,.2,1),visibility 0s linear 0s}
${S} .rr2-open-clip{min-height:0;overflow:hidden;margin:0 -12px}
${S} .rr2-open-pad{padding:24px 12px 16px}
${S} .rr2-open.is-open .rr2-card{animation:rr2-rise .45s cubic-bezier(.2,.7,.2,1) both}
${S} .rr2-card{display:grid;gap:24px;text-align:left;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2)));padding:clamp(20px,3vw,32px)}
${S} .rr2-card-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--ink);text-wrap:balance}
${S} .rr2-field{display:grid;gap:8px;min-width:0}
${S} .rr2-label{font-size:1rem;line-height:1.35;font-weight:700;color:var(--label-ink,var(--ink))}
${S} .rr2-label-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
${S} .rr2-opt{font-size:.875rem;line-height:1.2;font-weight:600;color:var(--muted)}
${S} .rr2-help{margin:-2px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
${S} .rr2-input{display:block;width:100%;min-height:56px;padding:0 16px;font:inherit;font-family:var(--font-body);font-size:1.0625rem;line-height:1.4;color:var(--field-ink);background:var(--field);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));transition:border-color .16s ease,box-shadow .16s ease;appearance:none}
${S} textarea.rr2-input{min-height:148px;padding:14px 16px;line-height:1.5;resize:vertical}
${S} .rr2-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
${S} .rr2-input:focus{outline:none;border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px var(--rr2-ring)}
${S} .rr2-input.is-invalid{border-color:var(--danger)}
${S} .rr2-input.is-invalid:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .25)}
${S} .rr2-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink) 4%,var(--field))}
${S} .rr2-count{margin:0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted)}
${S} .rr2-count.is-done{color:var(--success);font-weight:600}
${S} .rr2-err{margin:0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
${S} .rr2-ico{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em;flex:none}
${S} .rr2-drop{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px 16px;padding:16px;border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card));border:1px solid oklch(from var(--ink) l c h / .12);transition:border-color .16s ease,background-color .16s ease}
${S} .rr2-drop.is-drag{border-color:var(--field-focus,var(--accent));background:color-mix(in oklch,var(--accent) 8%,var(--card))}
${S} .rr2-drop.is-invalid{border-color:var(--danger)}
${S} .rr2-drop-ico{display:grid;place-items:center;width:48px;height:48px;color:var(--accent)}
${S} .rr2-thumb{display:block;width:56px;height:56px;border-radius:8px;object-fit:cover;object-position:center}
${S} .rr2-drop-copy{min-width:0}
${S} .rr2-drop-title{margin:0;font-size:1rem;line-height:1.35;font-weight:700;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
${S} .rr2-drop-note{margin:2px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted)}
${S} .rr2-drop-actions{display:flex;align-items:center;gap:8px}
${S} .rr2-btn2{display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:0 20px;border-radius:var(--button-radius,var(--radius,12px));border:1px solid var(--button-2-border,transparent);background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .2)));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:1rem;line-height:1.15;white-space:nowrap;cursor:pointer;transition:transform .16s ease,background-color .16s ease}
${S} .rr2-btn2:hover{background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .04) c h)}
${S} .rr2-btn2:active{transform:translateY(1px)}
${S} .rr2-file:focus-visible + .rr2-btn2{outline:3px solid var(--field-focus,var(--accent));outline-offset:2px}
${S} .rr2-file:disabled + .rr2-btn2{cursor:not-allowed;opacity:.6;transform:none}
${S} .rr2-remove{display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:10px;background:transparent;color:var(--muted);cursor:pointer;transition:background-color .16s ease,color .16s ease}
${S} .rr2-remove:hover{background:color-mix(in oklch,var(--ink) 8%,var(--card));color:var(--ink)}
${S} .rr2-remove:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:2px}
${S} .rr2-check{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr);gap:12px;align-items:start;padding:4px 0;cursor:pointer;font-size:1rem;line-height:1.45;font-weight:500;color:var(--ink);text-wrap:pretty}
${S} .rr2-box{display:grid;place-items:center;width:24px;height:24px;margin-top:1px;border-radius:6px;background:var(--field);border:2px solid color-mix(in oklch,var(--field-ink) 45%,var(--field));color:transparent;transition:background-color .16s ease,border-color .16s ease}
${S} .rr2-check input:checked + .rr2-box{background:var(--accent-fill,var(--accent));border-color:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
${S} .rr2-check input:focus-visible + .rr2-box{outline:3px solid var(--field-focus,var(--accent));outline-offset:2px}
${S} .rr2-check:has(input:disabled){cursor:not-allowed}
${S} .rr2-act{display:grid;justify-items:center;gap:12px;margin-top:24px}
${S} .rr2-btn{display:inline-flex;align-items:center;justify-content:center;gap:10px;width:100%;max-width:26rem;min-height:64px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--rr2-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--rr2-shadow) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease;text-wrap:balance}
${S} .rr2-btn:not(:disabled):hover{background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .12) c h / .6),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .18) c h),0 1px 2px oklch(from var(--rr2-shadow) l c h / .32),0 10px 18px -6px oklch(from var(--rr2-shadow) l c h / .52))}
${S} .rr2-btn:not(:disabled):active{transform:translateY(1px);box-shadow:inset 0 2px 3px oklch(from var(--button-bg,var(--cta)) calc(l - .2) c h / .45),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--rr2-shadow) l c h / .3)}
${S} .rr2-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
${S} .rr2-btn[aria-disabled="true"]{cursor:progress}
${S} .rr2-btn:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink) 10%,var(--surface));color:color-mix(in oklch,var(--ink) 62%,var(--surface));text-shadow:none;box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / .12)}
${S} .rr2-hint{margin:0;max-width:30rem;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty;transition:color .16s ease}
${S} .rr2-hint.is-nudge{color:var(--ink);font-weight:700}
${S} .rr2-rise{animation:rr2-rise .45s cubic-bezier(.2,.7,.2,1) both}
${S} .rr2-spin{animation:rr2-spin .8s linear infinite}
@keyframes rr2-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes rr2-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@keyframes rr2-spin{to{transform:rotate(360deg)}}
@media (max-width:560px){
${S} .rr2-stage{height:200px;margin-top:24px}
${S} .rr2-stars{width:100%;gap:4px}
${S} .rr2-star,${S} .rr2-star-face{min-height:56px}
${S} .rr2-star svg{width:44px;height:44px}
${S} .rr2-drop{grid-template-columns:auto minmax(0,1fr)}
${S} .rr2-drop-actions{grid-column:1 / -1}
${S} .rr2-drop-actions .rr2-btn2{flex:1}
}
/* !important: these rules must beat every state selector above so nothing moves under reduced motion */
@media (prefers-reduced-motion:reduce){${S} *,${S} *::before,${S} *::after{animation:none !important;transition:none !important}}
`;
pieces/forms/review-request-2/specimen.tsx 28 lines
import __studioImage52312529 from "../assets/34ae8baf1408a512.webp";
import React from "react";
import { ReviewRequest2 } from "../review-request-2";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled", "error"];
type SpecimenState = "default" | "hover" | "active" | "disabled" | "error";
export default function ReviewRequest2Specimen({ state = "default" }: { state?: SpecimenState }) {
return (
<ReviewRequest2
state={state}
productName="Fernhollow mug"
productImage={slot(
"product",
__studioImage52312529
)}
productAlt="Fernhollow stoneware mug with a speckled oatmeal glaze and a forest-green dipped base"
copy={{
headlinePlaceholder: "The mug I reach for every single morning",
reviewHelp: "How does it feel in your hand? What do you drink from your {product}?",
reviewPlaceholder: "The speckled glaze looks even better in person, and it keeps my coffee warm through the first email of the day…",
}}
onSubmit={() => {}}
/>
);
}
| Name | Type | Details |
|---|---|---|
productName OptionalReviewRequest2 |
string |
|
productImage OptionalReviewRequest2 |
string |
|
productAlt OptionalReviewRequest2 |
string |
|
copy OptionalReviewRequest2 |
Partial<ReviewRequest2Copy> |
|
minLength OptionalReviewRequest2 |
number |
|
maxPhotoMB OptionalReviewRequest2 |
number |
|
submitting OptionalReviewRequest2 |
boolean |
|
onSubmit OptionalReviewRequest2 |
(values: ReviewRequest2Values) => void |
|
state OptionalReviewRequest2 |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalReviewRequest2 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
34ae8baf1408a512.webp
image/webp · 43.3 KB