Referral Share 8
Refer-a-friend for a local practice: a three-stop path (share, friend books, reward) leads straight into a channel composer whose live preview makes sending the link feel easy and normal.
Use it in a prompt
Use checkout/referral-share-8 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/checkout/referral-share-8.tsx. - Import it and pass your copy and images (Props tab):
import { ReferralShare8 } from "@/components/funneldna/checkout/referral-share-8"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/referral-share-8/component.tsx 660 lines
// layout: path-to-action
// Refer-a-friend for a local practice: a three-stop path (share, friend books, reward) leads straight into a channel composer whose live preview makes sending the link feel easy and normal.
import * as React from 'react'
import { CalendarCheck, Check, CircleAlert, Copy, Gift, HeartHandshake, Link2, Mail, MessageSquare, Send } from 'lucide-react'
export type ReferralShare8Channel = 'text' | 'email' | 'copy'
export type ReferralShare8Copy = {
/** Section headline; may carry one emphasised phrase (className rs8-em). */
headline: React.ReactNode
/** Line under the headline; {business} is replaced. */
lead: string
/** Italic aside in the practice’s own voice; empty hides it. */
aside: string
/** Used for {business} when businessName is empty. */
businessFallback: string
pathLabel: string
step1Title: string
step1Detail: string
step2Title: string
/** {business} is replaced. */
step2Detail: string
/** Shown only when a reward is supplied; {reward} is replaced. */
step3Title: string
step3Detail: string
/** Shown when no reward is supplied. */
step3NoRewardTitle: string
step3NoRewardDetail: string
composerTitle: string
tabsLabel: string
tabs: Record<ReferralShare8Channel, string>
previewLabel: string
to: string
subjectLabel: string
previewEmpty: string
messageLabel: string
messageHint: string
messagePlaceholder: string
messageError: string
linkLabel: string
/** Example link shown in the read-only link field when no link is supplied. */
linkPlaceholder: string
/** {business} is replaced. */
copyHint: string
actions: Record<ReferralShare8Channel, string>
copied: string
notes: Record<ReferralShare8Channel, string>
copiedAnnounce: string
copyError: string
/** Starting message; {business} is replaced. */
message: string
/** Email subject; {business} is replaced. */
subject: string
}
type CopyInput = Partial<Omit<ReferralShare8Copy, 'tabs' | 'actions' | 'notes'>> & {
tabs?: Partial<Record<ReferralShare8Channel, string>>
actions?: Partial<Record<ReferralShare8Channel, string>>
notes?: Partial<Record<ReferralShare8Channel, string>>
}
export type ReferralShare8Props = {
/** The visitor’s personal referral link. */
link: string
/** The supplied reward both people get, e.g. “$25 off your next visit”. Empty hides every reward line. */
reward?: string
/** The practice or business name. */
businessName?: string
/** Illustration beside the headline (product slot), transparent background. */
illustrationImage?: string
illustrationAlt?: string
/** Starting message text; defaults to copy.message. */
message?: string
/** Email subject; defaults to copy.subject. */
subject?: string
defaultChannel?: ReferralShare8Channel
copy?: CopyInput
/** Called when the visitor sends by text or email (before the app opens) or after the link is copied. */
onAction?: (channel: ReferralShare8Channel, detail: { message: string; link: string; href?: string }) => void
disabled?: boolean
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success'
className?: string
}
export function ReferralShare8(props: ReferralShare8Props) {
const {
link,
reward = '',
businessName = '',
illustrationImage,
illustrationAlt = '',
defaultChannel = 'text',
onAction,
state = 'default',
className,
} = props
const c = mergeCopy(props.copy)
const disabled = Boolean(props.disabled) || state === 'disabled'
const hasReward = reward.trim().length > 0
const vars = { business: businessName.trim() || c.businessFallback, reward: reward.trim() }
const uid = React.useId().replace(/:/g, '')
const headId = `rs8-${uid}-head`
const panelId = `rs8-${uid}-panel`
const msgId = `rs8-${uid}-msg`
const hintId = `rs8-${uid}-hint`
const errId = `rs8-${uid}-err`
const linkId = `rs8-${uid}-link`
const noteId = `rs8-${uid}-note`
const tabId = (ch: ReferralShare8Channel) => `rs8-${uid}-tab-${ch}`
const rootRef = React.useRef<HTMLElement>(null)
const tabRefs = React.useRef<Array<HTMLButtonElement | null>>([])
const fieldRef = React.useRef<HTMLTextAreaElement>(null)
const linkRef = React.useRef<HTMLInputElement>(null)
const timer = React.useRef<number | null>(null)
const [tab, setTab] = React.useState<ReferralShare8Channel>(defaultChannel)
const [message, setMessage] = React.useState(() => fill(props.message ?? c.message, vars))
const [touched, setTouched] = React.useState(false)
const [copyStatus, setCopyStatus] = React.useState<'idle' | 'copied' | 'error'>('idle')
// static = finished look (no JS, reduced motion); armed = waiting offscreen; in = plays once.
const [motion, setMotion] = React.useState<'static' | 'armed' | 'in'>('static')
useIsoLayoutEffect(() => {
const el = rootRef.current
if (!el || typeof IntersectionObserver === 'undefined') return
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) return
setMotion('armed')
const io = new IntersectionObserver(
(entries) => {
if (entries.some((e) => e.isIntersecting)) {
setMotion('in')
io.disconnect()
}
},
{ threshold: 0.15 },
)
io.observe(el)
return () => io.disconnect()
}, [])
React.useEffect(() => {
return () => {
if (timer.current !== null) window.clearTimeout(timer.current)
}
}, [])
const active: ReferralShare8Channel =
state === 'success' ? 'copy' : state === 'error' && tab === 'copy' ? 'text' : tab
const text = state === 'error' ? '' : message
const trimmed = text.trim()
const showError = !disabled && (state === 'error' || (touched && trimmed.length === 0))
const shownCopy = disabled ? 'idle' : state === 'success' ? 'copied' : copyStatus
const subject = fill(props.subject ?? c.subject, vars)
const displayLink = stripProtocol(link)
const host = displayLink.split('/')[0]
const NL = String.fromCharCode(10)
const href =
active === 'text'
? `sms:?&body=${encodeURIComponent(`${trimmed} ${link}`)}`
: active === 'email'
? `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(`${trimmed}${NL}${NL}${link}`)}`
: undefined
function clearTimer() {
if (timer.current !== null) {
window.clearTimeout(timer.current)
timer.current = null
}
}
function select(ch: ReferralShare8Channel) {
clearTimer()
setTab(ch)
setCopyStatus('idle')
}
function onTabKey(e: React.KeyboardEvent<HTMLDivElement>) {
const i = ORDER.indexOf(active)
let next = -1
if (e.key === 'ArrowRight') next = (i + 1) % ORDER.length
else if (e.key === 'ArrowLeft') next = (i + ORDER.length - 1) % ORDER.length
else if (e.key === 'Home') next = 0
else if (e.key === 'End') next = ORDER.length - 1
if (next < 0) return
e.preventDefault()
select(ORDER[next])
const target = tabRefs.current[next]
if (target) target.focus()
}
function handleSend(e: React.MouseEvent<HTMLAnchorElement>) {
if (disabled) {
e.preventDefault()
return
}
if (!trimmed) {
e.preventDefault()
setTouched(true)
if (fieldRef.current) fieldRef.current.focus()
return
}
if (onAction) onAction(active, { message: trimmed, link, href })
}
async function handleCopy() {
if (disabled) return
let ok = false
try {
if (typeof navigator !== 'undefined' && navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(link)
ok = true
}
} catch {
ok = false
}
if (!ok && linkRef.current) {
linkRef.current.focus()
linkRef.current.select()
try {
ok = document.execCommand('copy')
} catch {
ok = false
}
}
clearTimer()
if (ok) {
setCopyStatus('copied')
if (onAction) onAction('copy', { message: trimmed, link })
timer.current = window.setTimeout(() => setCopyStatus('idle'), 2400)
} else {
setCopyStatus('error')
}
}
const stops = [
{ key: 'share', Icon: Send, title: fill(c.step1Title, vars), detail: fill(c.step1Detail, vars), goal: false },
{ key: 'book', Icon: CalendarCheck, title: fill(c.step2Title, vars), detail: fill(c.step2Detail, vars), goal: false },
hasReward
? { key: 'reward', Icon: Gift, title: fill(c.step3Title, vars), detail: fill(c.step3Detail, vars), goal: true }
: { key: 'care', Icon: HeartHandshake, title: fill(c.step3NoRewardTitle, vars), detail: fill(c.step3NoRewardDetail, vars), goal: true },
]
const rootClass = ['cf-referral-share-8', motion === 'armed' ? 'is-armed' : '', motion === 'in' ? 'is-in' : '', className || '']
.filter(Boolean)
.join(' ')
const ctaClass = ['rs8-cta', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : ''].filter(Boolean).join(' ')
const ActionIcon = active === 'email' ? Mail : MessageSquare
let preview: React.ReactNode
if (active === 'copy') {
preview = (
<div className='rs8-copybox'>
<label htmlFor={linkId} className='rs8-label'>
{c.linkLabel}
</label>
<div className='rs8-linkrow'>
<Link2 className='rs8-linkicon' size={20} strokeWidth={2.5} aria-hidden />
<input
id={linkId}
ref={linkRef}
className='rs8-linkfield'
type='url'
readOnly
value={link}
placeholder={c.linkPlaceholder}
onFocus={(e) => e.currentTarget.select()}
/>
</div>
<p className='rs8-hint rs8-hint-after'>{fill(c.copyHint, vars)}</p>
</div>
)
} else if (active === 'email') {
preview = (
<div className='rs8-thread'>
<p className='rs8-to'>{c.to}</p>
<div className='rs8-bubble is-mail'>
<p className='rs8-subj'>
<span className='rs8-subj-label'>{c.subjectLabel}</span> {subject}
</p>
<p className='rs8-btext'>{trimmed ? trimmed : <span className='rs8-empty'>{c.previewEmpty}</span>}</p>
<p className='rs8-mlink'>{displayLink}</p>
</div>
</div>
)
} else {
preview = (
<div className='rs8-thread'>
<p className='rs8-to'>{c.to}</p>
<div className='rs8-bubble is-out'>
<p className='rs8-btext'>
{trimmed ? (
<>
{trimmed} <span className='rs8-blink'>{displayLink}</span>
</>
) : (
<span className='rs8-empty'>{c.previewEmpty}</span>
)}
</p>
<div className='rs8-linkcard'>
{illustrationImage ? (
<img className='rs8-thumb' src={illustrationImage} alt='' width={40} height={40} />
) : (
<Link2 size={20} strokeWidth={2.5} aria-hidden />
)}
<span className='rs8-linkmeta'>
<strong>{businessName.trim() || host}</strong>
<span>{host}</span>
</span>
</div>
</div>
</div>
)
}
const action =
active === 'copy' ? (
<button type='button' className={ctaClass} disabled={disabled} aria-describedby={noteId} onClick={handleCopy}>
{shownCopy === 'copied' ? (
<Check size={20} strokeWidth={2.5} aria-hidden />
) : (
<Copy size={20} strokeWidth={2.5} aria-hidden />
)}
<span>{shownCopy === 'copied' ? c.copied : c.actions.copy}</span>
</button>
) : (
<a
className={ctaClass}
href={disabled ? undefined : href}
role={disabled ? 'link' : undefined}
aria-disabled={disabled || undefined}
aria-describedby={noteId}
onClick={handleSend}
>
<ActionIcon size={20} strokeWidth={2.5} aria-hidden />
<span>{c.actions[active]}</span>
</a>
)
return (
<section ref={rootRef} className={rootClass} aria-labelledby={headId}>
<style>{CSS}</style>
<div className='rs8-wrap'>
<header className={illustrationImage ? 'rs8-head' : 'rs8-head no-art'}>
<div className='rs8-copy rs8-rv'>
<h2 id={headId} className='rs8-h2'>
{c.headline}
</h2>
{c.lead ? <p className='rs8-lead'>{fill(c.lead, vars)}</p> : null}
{c.aside ? <p className='rs8-aside'>{c.aside}</p> : null}
</div>
{illustrationImage ? (
<img className='rs8-art' src={illustrationImage} alt={illustrationAlt} width={480} height={480} />
) : null}
</header>
<ol className='rs8-path' aria-label={c.pathLabel}>
{stops.map((s, i) => (
<li
key={s.key}
className={s.goal ? 'rs8-stop is-goal rs8-rv' : 'rs8-stop rs8-rv'}
style={{ '--rs8-d': `${i * 0.07}s` } as React.CSSProperties}
>
{i < stops.length - 1 ? (
<span
className='rs8-seg'
aria-hidden
style={{ '--rs8-fd': `${0.16 + i * 0.42}s` } as React.CSSProperties}
/>
) : null}
<span className='rs8-node' aria-hidden>
<s.Icon size={24} strokeWidth={2.5} />
</span>
<div className='rs8-text'>
<h3 className='rs8-title'>
<span className='rs8-num'>{i + 1}</span> {s.title}
</h3>
<p className='rs8-detail'>{s.detail}</p>
</div>
</li>
))}
</ol>
<div className='rs8-composer rs8-rv' style={{ '--rs8-d': '0.21s' } as React.CSSProperties}>
<div className='rs8-chead'>
<h3 className='rs8-ctitle'>{c.composerTitle}</h3>
<div role='tablist' aria-label={c.tabsLabel} className='rs8-tabs' onKeyDown={onTabKey}>
{ORDER.map((ch, i) => {
const Icon = TAB_ICON[ch]
const selected = ch === active
return (
<button
key={ch}
ref={(el) => {
tabRefs.current[i] = el
}}
type='button'
role='tab'
id={tabId(ch)}
aria-selected={selected}
aria-controls={panelId}
tabIndex={selected ? 0 : -1}
className='rs8-tab'
onClick={() => select(ch)}
>
<Icon size={16} strokeWidth={2.5} aria-hidden />
{c.tabs[ch]}
</button>
)
})}
</div>
</div>
<div role='tabpanel' id={panelId} aria-labelledby={tabId(active)} className='rs8-body'>
<div className='rs8-stage' role='group' aria-label={c.previewLabel}>
<div key={active} className='rs8-pop'>
{preview}
</div>
</div>
<div className='rs8-editor'>
{active !== 'copy' ? (
<div className='rs8-msg'>
<label htmlFor={msgId} className='rs8-label'>
{c.messageLabel}
</label>
<p id={hintId} className='rs8-hint'>
{c.messageHint}
</p>
<textarea
id={msgId}
ref={fieldRef}
className='rs8-field'
rows={5}
value={text}
placeholder={c.messagePlaceholder}
disabled={disabled}
aria-invalid={showError || undefined}
aria-describedby={showError ? `${hintId} ${errId}` : hintId}
onChange={(e) => setMessage(e.target.value)}
onBlur={() => setTouched(true)}
/>
{showError ? (
<p id={errId} className='rs8-err'>
<CircleAlert size={16} strokeWidth={2.5} aria-hidden />
{c.messageError}
</p>
) : null}
</div>
) : null}
<div className={active === 'copy' ? 'rs8-act is-first' : 'rs8-act'}>
{action}
<p id={noteId} className='rs8-note'>
{c.notes[active]}
</p>
{active === 'copy' && shownCopy === 'error' ? (
<p className='rs8-err rs8-err-center' role='alert'>
<CircleAlert size={16} strokeWidth={2.5} aria-hidden />
{c.copyError}
</p>
) : null}
</div>
</div>
</div>
</div>
<p className='rs8-sr' aria-live='polite'>
{shownCopy === 'copied' ? c.copiedAnnounce : ''}
</p>
</div>
</section>
)
}
export default ReferralShare8
const ORDER: ReferralShare8Channel[] = ['text', 'email', 'copy']
const TAB_ICON = { text: MessageSquare, email: Mail, copy: Link2 }
const DEFAULT_COPY: ReferralShare8Copy = {
headline: (
<>
Know someone who keeps <span className='rs8-em'>putting off the dentist</span>?
</>
),
lead: 'Share your link with one friend who’s due for a check-up. Here’s all it takes.',
aside: '(Honestly, a word from you means more to us than any ad we could ever run.)',
businessFallback: 'our practice',
pathLabel: 'How referring a friend works',
step1Title: 'Share your link',
step1Detail: 'Text it, email it, or paste it anywhere you chat.',
step2Title: 'Your friend books',
step2Detail: 'They choose a visit at {business} that suits them.',
step3Title: 'You both get {reward}',
step3Detail: 'Our thank-you for sending them our way.',
step3NoRewardTitle: 'Your friend gets the same care',
step3NoRewardDetail: 'The same team that looked after you.',
composerTitle: 'Send it while you’re thinking of them',
tabsLabel: 'Choose how to share',
tabs: { text: 'Text', email: 'Email', copy: 'Copy link' },
previewLabel: 'Message preview',
to: 'To: your friend',
subjectLabel: 'Subject:',
previewEmpty: 'Your message will show here.',
messageLabel: 'Your message',
messageHint: 'Make it sound like you. Your link is added at the end.',
messagePlaceholder: 'Hey! I just had my check-up and thought of you…',
messageError: 'Add a few words so your friend knows it’s from you.',
linkLabel: 'Your referral link',
linkPlaceholder: 'https://example.com/r/your-name',
copyHint: 'Your friend taps it to book with {business}.',
actions: { text: 'Send it by text', email: 'Send it by email', copy: 'Copy my link' },
copied: 'Copied',
notes: {
text: 'Opens your messages app with this note ready to send.',
email: 'Opens your email app with this note ready to send.',
copy: 'Paste it wherever you and your friends talk.',
},
copiedAnnounce: 'Your link is copied. Paste it anywhere.',
copyError: 'We couldn’t copy it automatically. Select the link above and copy it.',
message: 'I just had my visit at {business} and thought of you. The team was lovely. Here’s my link if you want to book:',
subject: 'Thought of you: {business}',
}
function mergeCopy(input?: CopyInput): ReferralShare8Copy {
const i = input || {}
return {
...DEFAULT_COPY,
...i,
tabs: { ...DEFAULT_COPY.tabs, ...(i.tabs || {}) },
actions: { ...DEFAULT_COPY.actions, ...(i.actions || {}) },
notes: { ...DEFAULT_COPY.notes, ...(i.notes || {}) },
} as ReferralShare8Copy
}
function fill(template: string, vars: Record<string, string>) {
return Object.keys(vars).reduce((out, key) => out.split(`{${key}}`).join(vars[key]), template)
}
function stripProtocol(url: string) {
const at = url.indexOf('://')
const rest = at >= 0 ? url.slice(at + 3) : url
return rest.endsWith('/') ? rest.slice(0, -1) : rest
}
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect
const CSS = `
.cf-referral-share-8{--rs8-g:clamp(24px,3vw,40px);--rs8-shadow:var(--shadow,oklch(0.22 0.03 260));position:relative;background:var(--surface,#ffffff);color:var(--ink,#141b2d);font-family:var(--font-body,system-ui,sans-serif);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);overflow-x:clip}
.cf-referral-share-8 *,.cf-referral-share-8 *::before,.cf-referral-share-8 *::after{box-sizing:border-box}
.cf-referral-share-8 .rs8-wrap{max-width:1120px;margin:0 auto}
.cf-referral-share-8 .rs8-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:clamp(32px,5vw,72px);align-items:start}
.cf-referral-share-8 .rs8-head.no-art{grid-template-columns:minmax(0,1fr)}
.cf-referral-share-8 .rs8-copy{max-width:46rem;min-width:0}
.cf-referral-share-8 .rs8-h2{margin:0 0 16px;font-family:var(--font-display,inherit);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,#141b2d);text-wrap:balance}
.cf-referral-share-8 .rs8-em{color:var(--accent,#2457c5)}
.cf-referral-share-8 .rs8-lead{margin:0;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted,#4a5568);text-wrap:pretty}
.cf-referral-share-8 .rs8-aside{margin:12px 0 0;max-width:60ch;font-style:italic;color:var(--ink,#141b2d);text-wrap:pretty}
.cf-referral-share-8 .rs8-art{display:block;width:clamp(150px,19vw,240px);height:auto;aspect-ratio:1/1;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--rs8-shadow) l c h / 0.2)) drop-shadow(0 14px 18px oklch(from var(--rs8-shadow) l c h / 0.16))}
.cf-referral-share-8 .rs8-path{list-style:none;margin:clamp(40px,5vw,64px) 0 0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--rs8-g)}
.cf-referral-share-8 .rs8-stop{position:relative;display:grid;grid-template-columns:minmax(0,1fr);row-gap:16px;align-content:start;min-width:0}
.cf-referral-share-8 .rs8-node{position:relative;z-index:1;width:48px;height:48px;border-radius:999px;display:grid;place-items:center;background:var(--card,#ffffff);color:var(--ink,#141b2d);border:2px solid oklch(from var(--ink,#141b2d) l c h / 0.16);box-shadow:var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / 0.2))}
.cf-referral-share-8 .rs8-stop.is-goal .rs8-node{background:var(--accent-fill,var(--accent,#2457c5));color:var(--accent-fill-ink,var(--card,#ffffff));border-color:transparent;box-shadow:var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22),0 4px 10px -2px oklch(0.22 0.03 260 / 0.2))}
.cf-referral-share-8 .rs8-seg{position:absolute;top:22px;left:56px;width:calc(100% - 64px + var(--rs8-g));height:4px;border-radius:999px;background:oklch(from var(--ink,#141b2d) l c h / 0.1);overflow:hidden}
.cf-referral-share-8 .rs8-seg::after{content:'';position:absolute;inset:0;border-radius:inherit;background:var(--accent-fill,var(--accent,#2457c5));transform-origin:left center}
.cf-referral-share-8 .rs8-text{min-width:0}
.cf-referral-share-8 .rs8-title,.cf-referral-share-8 .rs8-ctitle{margin:0;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--ink,#141b2d);text-wrap:balance}
.cf-referral-share-8 .rs8-num{color:var(--accent,#2457c5);margin-inline-end:0.1em;font-variant-numeric:tabular-nums}
.cf-referral-share-8 .rs8-detail{margin:8px 0 0;max-width:34ch;color:var(--muted,#4a5568);text-wrap:pretty}
.cf-referral-share-8 .rs8-composer{margin-top:clamp(48px,6vw,72px);background:var(--card,#ffffff);color:var(--ink,#141b2d);border:1px solid var(--card-border,oklch(from var(--ink,#141b2d) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / 0.22),0 12px 24px -8px oklch(0.22 0.03 260 / 0.32)));padding:clamp(20px,3vw,32px)}
.cf-referral-share-8 .rs8-chead{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px 24px;margin-bottom:24px}
.cf-referral-share-8 .rs8-tabs{display:grid;grid-template-columns:repeat(3,auto);gap:4px;padding:4px;border-radius:calc(var(--radius,12px) + 4px);background:color-mix(in oklch,var(--ink,#141b2d) 6%,var(--card,#ffffff))}
.cf-referral-share-8 .rs8-tab{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;margin:0;border:0;border-radius:var(--radius,12px);background:transparent;color:color-mix(in oklch,var(--ink,#141b2d) 80%,var(--card,#ffffff));font-family:var(--font-body,inherit);font-size:0.9375rem;font-weight:700;line-height:1.2;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background 0.16s ease,color 0.16s ease,box-shadow 0.16s ease,transform 0.16s ease}
.cf-referral-share-8 .rs8-tab:hover{color:var(--ink,#141b2d);background:oklch(from var(--ink,#141b2d) l c h / 0.06)}
.cf-referral-share-8 .rs8-tab:active{transform:translateY(1px)}
.cf-referral-share-8 .rs8-tab[aria-selected='true']{background:var(--card,#ffffff);color:var(--ink,#141b2d);box-shadow:var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / 0.2))}
.cf-referral-share-8 .rs8-tab:focus-visible{outline:3px solid oklch(from var(--accent,#2457c5) l c h / 0.55);outline-offset:2px}
.cf-referral-share-8 .rs8-body{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:clamp(24px,4vw,48px);align-items:start}
.cf-referral-share-8 .rs8-stage{min-width:0;border-radius:10px;background:color-mix(in oklch,var(--ink,#141b2d) 4%,var(--card,#ffffff));padding:clamp(20px,3vw,32px)}
.cf-referral-share-8 .rs8-to{margin:0 0 12px;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--muted,#4a5568)}
.cf-referral-share-8 .rs8-bubble{border-radius:20px;padding:14px 18px;overflow-wrap:anywhere}
.cf-referral-share-8 .rs8-bubble.is-out{margin-left:auto;width:fit-content;max-width:min(100%,30rem);background:var(--accent-fill,var(--accent,#2457c5));color:var(--accent-fill-ink,var(--card,#ffffff));border-bottom-right-radius:6px}
.cf-referral-share-8 .rs8-bubble.is-mail{background:var(--card,#ffffff);color:var(--ink,#141b2d);border:1px solid oklch(from var(--ink,#141b2d) l c h / 0.12);border-top-left-radius:6px}
.cf-referral-share-8 .rs8-btext{margin:0;white-space:pre-wrap;line-height:1.45;text-wrap:pretty}
.cf-referral-share-8 .rs8-blink{font-weight:700;text-decoration:underline;text-underline-offset:0.18em}
.cf-referral-share-8 .rs8-empty{font-style:italic}
.cf-referral-share-8 .rs8-linkcard{display:flex;align-items:center;gap:12px;margin-top:12px;padding-top:12px;border-top:1px solid oklch(from var(--accent-fill-ink,#ffffff) l c h / 0.3)}
.cf-referral-share-8 .rs8-thumb{display:block;flex:none;width:40px;height:40px;object-fit:contain}
.cf-referral-share-8 .rs8-linkcard svg{flex:none}
.cf-referral-share-8 .rs8-linkmeta{display:grid;min-width:0;font-size:0.9375rem;line-height:1.3}
.cf-referral-share-8 .rs8-linkmeta strong{font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cf-referral-share-8 .rs8-linkmeta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cf-referral-share-8 .rs8-subj{margin:0 0 12px;padding-bottom:12px;border-bottom:1px solid oklch(from var(--ink,#141b2d) l c h / 0.12);font-weight:700;line-height:1.35}
.cf-referral-share-8 .rs8-subj-label{font-weight:600;color:var(--muted,#4a5568)}
.cf-referral-share-8 .rs8-mlink{margin:12px 0 0;font-weight:700;color:var(--link,var(--accent,#2457c5));text-decoration:underline;text-decoration-color:oklch(from var(--link,var(--accent,#2457c5)) l c h / 0.45);text-underline-offset:0.18em}
.cf-referral-share-8 .rs8-label{display:block;margin:0 0 4px;font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink,#141b2d))}
.cf-referral-share-8 .rs8-hint{margin:0 0 12px;font-size:0.9375rem;line-height:1.4;color:var(--muted,#4a5568);text-wrap:pretty}
.cf-referral-share-8 .rs8-hint-after{margin:12px 0 0}
.cf-referral-share-8 .rs8-field{display:block;width:100%;min-height:148px;resize:vertical;margin:0;padding:14px 16px;font-family:var(--font-body,inherit);font-size:17px;line-height:1.5;color:var(--field-ink,#141b2d);background:var(--field,#ffffff);border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#141b2d) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));transition:border-color 0.16s ease,box-shadow 0.16s ease}
.cf-referral-share-8 .rs8-field::placeholder,.cf-referral-share-8 .rs8-linkfield::placeholder{color:color-mix(in oklch,var(--field-ink,#141b2d) 65%,var(--field,#ffffff));opacity:1}
.cf-referral-share-8 .rs8-field:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink,#141b2d) 38%,transparent)}
.cf-referral-share-8 .rs8-field:focus,.cf-referral-share-8 .rs8-linkfield:focus{outline:none;border-color:var(--field-focus,var(--accent,#2457c5));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent,#2457c5)) l c h / 0.35)}
.cf-referral-share-8 .rs8-field[aria-invalid='true']{border-color:var(--danger,#c0262d)}
.cf-referral-share-8 .rs8-field[aria-invalid='true']:focus{box-shadow:0 0 0 3px oklch(from var(--danger,#c0262d) l c h / 0.3)}
.cf-referral-share-8 .rs8-field:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--field-ink,#141b2d) 5%,var(--field,#ffffff))}
.cf-referral-share-8 .rs8-err{margin:8px 0 0;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--danger,#c0262d);text-wrap:pretty}
.cf-referral-share-8 .rs8-err svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
.cf-referral-share-8 .rs8-err-center{text-align:center}
.cf-referral-share-8 .rs8-linkrow{position:relative}
.cf-referral-share-8 .rs8-linkicon{position:absolute;left:16px;top:50%;transform:translateY(-50%);color:var(--field-ink,#141b2d);pointer-events:none}
.cf-referral-share-8 .rs8-linkfield{display:block;width:100%;height:56px;margin:0;padding:0 16px 0 48px;font-family:var(--font-body,inherit);font-size:17px;font-weight:600;color:var(--field-ink,#141b2d);background:var(--field,#ffffff);border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#141b2d) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));text-overflow:ellipsis}
.cf-referral-share-8 .rs8-act{margin-top:24px}
.cf-referral-share-8 .rs8-act.is-first{margin-top:0}
.cf-referral-share-8 .rs8-cta{--rs8-bg:var(--button-bg,var(--cta,#d63a2f));--rs8-bg2:var(--button-bg-2,var(--cta-2,#b52c22));display:flex;width:100%;align-items:center;justify-content:center;gap:10px;min-height:64px;padding:0 28px;margin:0;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--rs8-bg) calc(l + 0.04) c h),oklch(from var(--rs8-bg2) calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink,#ffffff));font-family:var(--button-font,var(--font-display,inherit));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;letter-spacing:-0.005em;text-decoration:none;text-shadow:var(--button-text-shadow,none);white-space:nowrap;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--rs8-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--rs8-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--rs8-shadow) l c h / 0.3),0 8px 16px -6px oklch(from var(--rs8-shadow) l c h / 0.45));cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform 0.16s ease,box-shadow 0.16s ease,background 0.16s ease}
.cf-referral-share-8 .rs8-cta svg{flex:none}
.cf-referral-share-8 .rs8-cta:hover,.cf-referral-share-8 .rs8-cta.is-hover{background:linear-gradient(oklch(from var(--rs8-bg) calc(l - 0.01) c h),oklch(from var(--rs8-bg2) calc(l - 0.07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--rs8-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--rs8-bg) calc(l - 0.18) c h),0 1px 2px oklch(from var(--rs8-shadow) l c h / 0.34),0 10px 20px -6px oklch(from var(--rs8-shadow) l c h / 0.52))}
.cf-referral-share-8 .rs8-cta:active,.cf-referral-share-8 .rs8-cta.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--rs8-bg) calc(l - 0.04) c h),oklch(from var(--rs8-bg2) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--rs8-shadow) l c h / 0.35),inset 0 -2px 0 oklch(from var(--rs8-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--rs8-shadow) l c h / 0.25)}
.cf-referral-share-8 .rs8-cta:focus-visible{outline:3px solid oklch(from var(--rs8-bg) l c h / 0.45);outline-offset:3px}
.cf-referral-share-8 .rs8-cta:disabled,.cf-referral-share-8 .rs8-cta:disabled:hover,.cf-referral-share-8 .rs8-cta[aria-disabled='true'],.cf-referral-share-8 .rs8-cta[aria-disabled='true']:hover{background:var(--button-2-bg,var(--secondary,#e6e9ef));color:var(--button-2-ink,var(--secondary-ink,#141b2d));box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / 0.2)));text-shadow:none;transform:none;cursor:not-allowed}
.cf-referral-share-8 .rs8-note{margin:12px 0 0;text-align:center;font-size:0.9375rem;font-weight:500;line-height:1.4;color:var(--muted,#4a5568);text-wrap:pretty}
.cf-referral-share-8 .rs8-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (max-width:760px){
.cf-referral-share-8 .rs8-head{grid-template-columns:minmax(0,1fr);gap:24px}
.cf-referral-share-8 .rs8-art{order:-1;width:128px;justify-self:start}
.cf-referral-share-8 .rs8-path{grid-template-columns:minmax(0,1fr)}
.cf-referral-share-8 .rs8-stop{grid-template-columns:48px minmax(0,1fr);column-gap:16px;row-gap:0}
.cf-referral-share-8 .rs8-text{padding-top:11px}
.cf-referral-share-8 .rs8-detail{max-width:none}
.cf-referral-share-8 .rs8-seg{top:56px;left:22px;width:4px;height:calc(100% - 64px + var(--rs8-g))}
.cf-referral-share-8 .rs8-seg::after{transform-origin:center top}
.cf-referral-share-8 .rs8-body{grid-template-columns:minmax(0,1fr)}
.cf-referral-share-8 .rs8-chead{flex-direction:column;align-items:stretch}
.cf-referral-share-8 .rs8-tabs{grid-template-columns:repeat(3,minmax(0,1fr))}
.cf-referral-share-8 .rs8-tab{padding:0 10px}
}
@media (max-width:440px){
.cf-referral-share-8 .rs8-tab svg{display:none}
.cf-referral-share-8 .rs8-tab{padding:0 6px}
.cf-referral-share-8 .rs8-cta{padding:0 20px}
}
@keyframes rs8-rise{from{opacity:0.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes rs8-fill-x{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes rs8-fill-y{from{transform:scaleY(0)}to{transform:scaleY(1)}}
@keyframes rs8-pop{from{opacity:0.82;transform:scale(0.97)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:no-preference){
.cf-referral-share-8.is-armed .rs8-rv{opacity:0.82;transform:translateY(8px)}
.cf-referral-share-8.is-in .rs8-rv{animation:rs8-rise 0.45s cubic-bezier(0.2,0.7,0.2,1) both;animation-delay:var(--rs8-d,0s)}
.cf-referral-share-8.is-armed .rs8-seg::after{transform:scaleX(0)}
.cf-referral-share-8.is-in .rs8-seg::after{animation:rs8-fill-x 0.45s cubic-bezier(0.2,0.7,0.2,1) both;animation-delay:var(--rs8-fd,0s)}
.cf-referral-share-8 .rs8-pop{transform-origin:center;animation:rs8-pop 0.3s cubic-bezier(0.2,0.7,0.2,1) both}
}
@media (prefers-reduced-motion:no-preference) and (max-width:760px){
.cf-referral-share-8.is-armed .rs8-seg::after{transform:scaleY(0)}
.cf-referral-share-8.is-in .rs8-seg::after{animation-name:rs8-fill-y}
}
@media (prefers-reduced-motion:reduce){
.cf-referral-share-8 .rs8-cta,.cf-referral-share-8 .rs8-tab,.cf-referral-share-8 .rs8-field{transition:none}
}
`
pieces/checkout/referral-share-8/specimen.tsx 23 lines
import __studioImagebd811721 from "../assets/625f4272aff24da6.webp";
// Specimen: Bright Harbor Dental’s review thank-you, asking a happy patient to refer one friend.
import * as React from 'react'
import { ReferralShare8, type ReferralShare8Props } from '../referral-share-8'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error', 'success']
export default function ReferralShare8Specimen({ state }: { state?: ReferralShare8Props['state'] }) {
return (
<ReferralShare8
businessName='Bright Harbor Dental'
link='https://brightharbordental.com/r/maya-k'
reward='$25 off your next visit'
illustrationImage={slot(
'product',
__studioImagebd811721,
)}
illustrationAlt='Illustration of a smiling tooth with a toothbrush and floss'
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
link RequiredReferralShare8 |
string |
|
reward OptionalReferralShare8 |
string |
|
businessName OptionalReferralShare8 |
string |
|
illustrationImage OptionalReferralShare8 |
string |
|
illustrationAlt OptionalReferralShare8 |
string |
|
message OptionalReferralShare8 |
string |
|
subject OptionalReferralShare8 |
string |
|
defaultChannel OptionalReferralShare8 |
ReferralShare8Channel |
|
copy OptionalReferralShare8 |
CopyInput |
|
onAction OptionalReferralShare8 |
(channel: ReferralShare8Channel, detail: { message: string; link: string; href?: string }) => void |
|
disabled OptionalReferralShare8 |
boolean |
|
state OptionalReferralShare8 |
'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success' |
|
className OptionalReferralShare8 |
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-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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
625f4272aff24da6.webp
image/webp · 219 KB