Commitment Pledge 4
Commitment step for a challenge: the registrant types the one line that explains why they joined, watches it set live as a printed pull line signed with their first name, then locks it in.
Use it in a prompt
Use forms/commitment-pledge-4 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/commitment-pledge-4.tsx. - Import it and pass your copy and images (Props tab):
import { CommitmentPledge4 } from "@/components/funneldna/forms/commitment-pledge-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/commitment-pledge-4/component.tsx 444 lines
// layout: bento-grid
// Commitment step for a challenge: the registrant types the one line that explains why they joined, watches it set live as a printed pull line signed with their first name, then locks it in.
'use client'
import * as React from 'react'
import { AlertCircle, Loader2 } from 'lucide-react'
import { FX_HOST, Spot, Texture } from '../fx/fx'
import calendar from '../fx/spots/calendar'
import linen from '../fx/textures/linen'
export type CommitmentPledge4State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type CommitmentPledge4Copy = typeof defaultCopy
export type CommitmentPledge4Props = {
/** Every visible word. Templates accept {count}, {max}, {left}, {min}, {firstName} and {eventName} as text. */
copy?: Partial<CommitmentPledge4Copy>
/** Replaces the headline built from copy.headlineLead, copy.headlineMark and copy.headlineTail. */
headline?: React.ReactNode
/** Challenge name, used in the attribution under the pull line. */
eventName?: string
/** The registrant's first name when the funnel already knows it; hides the first-name field. */
firstName?: string
defaultFirstName?: string
defaultReason?: string
/** Character limit for the reason (20 to 240). */
maxLength?: number
/** Shortest reason accepted on submit. */
minLength?: number
/** Future pacing tile. Only pass it when the challenge really reads the line back. */
readBack?: { title: string; line: React.ReactNode }
/** scene slot: the photo tile beside the pledge. Omit it to hide the tile. */
sceneImage?: string
sceneAlt?: string
disabled?: boolean
state?: CommitmentPledge4State
/** Validated pledge. Return a promise to show the loading label. */
onSubmit?: (pledge: { reason: string; firstName: string }) => void | Promise<void>
className?: string
style?: React.CSSProperties
}
export function CommitmentPledge4({
copy: copyOverrides,
headline,
eventName,
firstName,
defaultFirstName = '',
defaultReason = '',
maxLength = 100,
minLength = 10,
readBack,
sceneImage,
sceneAlt = '',
disabled = false,
state = 'default',
onSubmit,
className,
style,
}: CommitmentPledge4Props) {
const copy = { ...defaultCopy, ...copyOverrides }
const uid = React.useId().replace(/:/g, '')
const isDisabled = disabled || state === 'disabled'
const askName = firstName === undefined
const [reason, setReason] = React.useState(defaultReason)
const [nameValue, setNameValue] = React.useState(defaultFirstName)
const [tried, setTried] = React.useState(state === 'error')
const [loading, setLoading] = React.useState(false)
const [focused, setFocused] = React.useState(false)
const mounted = React.useRef(true)
const reasonRef = React.useRef<HTMLTextAreaElement>(null)
const nameRef = React.useRef<HTMLInputElement>(null)
React.useEffect(() => {
setReason(defaultReason)
setNameValue(defaultFirstName)
setTried(state === 'error')
setLoading(false)
}, [state, defaultReason, defaultFirstName])
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
const max = Math.min(Math.max(Math.round(maxLength) || 100, 20), 240)
const min = Math.min(Math.max(Math.round(minLength) || 1, 1), max)
const typed = reason.replace(/\s+/g, ' ').trim()
const count = reason.length
const left = Math.max(max - count, 0)
const warn = left <= Math.max(10, Math.round(max * 0.15))
const atLimit = left === 0
const signed = (askName ? nameValue : firstName ?? '').trim()
const hasText = typed.length > 0
const reasonOk = typed.length >= min
const nameOk = !askName || signed.length > 0
const reasonErr = tried && !reasonOk
const nameErr = tried && !nameOk
const force = state === 'hover' || state === 'active' ? state : undefined
const vars = { count, max, left, min, firstName: signed || copy.youFallback, eventName: eventName ?? '' }
const attribution = text(eventName ? copy.attribution : copy.attributionNoEvent, vars)
const note = isDisabled ? copy.disabledNote : !hasText ? copy.lockedNote : ''
const lower = sceneImage && readBack ? 'both' : sceneImage ? 'photo' : readBack ? 'pacing' : 'none'
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (isDisabled || loading || !hasText) return
setTried(true)
if (!reasonOk) {
reasonRef.current?.focus()
return
}
if (!nameOk) {
nameRef.current?.focus()
return
}
const result = onSubmit?.({ reason: typed, firstName: signed }) as Promise<void> | undefined
if (!result || typeof result.then !== 'function') return
setLoading(true)
try {
await result
} catch {
// The caller reports failures; this piece only resets its button.
} finally {
if (mounted.current) setLoading(false)
}
}
const reasonDescribed = [uid + '-count', reasonErr ? uid + '-rerr' : ''].filter(Boolean).join(' ')
return (
<section
className={['cf-commitment-pledge-4', className].filter(Boolean).join(' ')}
data-force={force}
style={style}
aria-labelledby={uid + '-h'}
>
<style dangerouslySetInnerHTML={{ __html: CSS }} />
<div className='cp4-wrap'>
<header className='cp4-head'>
<h2 id={uid + '-h'} className='cp4-title'>
{headline ?? (
<>
{copy.headlineLead} <span className='cp4-em'>{copy.headlineMark}</span> {copy.headlineTail}
</>
)}
</h2>
<p className='cp4-lead'>
<strong>{copy.leadBold}</strong> {copy.lead}
</p>
</header>
<div className='cp4-grid' data-lower={lower}>
<figure
className='cp4-preview cp4-tile'
data-focus={focused && !isDisabled ? '' : undefined}
aria-hidden='true'
style={{ ...FX_HOST, '--i': 0 } as React.CSSProperties}
>
<Texture src={linen} tone='band-ink' />
<div className='cp4-preview-in'>
<blockquote className='cp4-quote'>
{hasText ? (
<span className='cp4-words'>{'\u201C' + typed + '\u201D'}</span>
) : (
<span className='cp4-prompt'>{copy.emptyPrompt}</span>
)}
<span className='cp4-caret' />
</blockquote>
<figcaption className='cp4-by'>
<span className='cp4-rule' />
<span>{attribution}</span>
</figcaption>
</div>
</figure>
<form
className='cp4-form cp4-tile'
noValidate
onSubmit={handleSubmit}
aria-busy={loading || undefined}
style={{ '--i': 1 } as React.CSSProperties}
>
<h3 className='cp4-form-title'>{copy.formTitle}</h3>
<div className='cp4-field'>
<label className='cp4-label' htmlFor={uid + '-reason'}>
{copy.reasonLabel}
</label>
<textarea
ref={reasonRef}
id={uid + '-reason'}
name='reason'
className='cp4-control cp4-textarea'
rows={3}
maxLength={max}
value={reason}
disabled={isDisabled}
placeholder={copy.reasonPlaceholder}
aria-invalid={reasonErr || undefined}
aria-describedby={reasonDescribed}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
onChange={(event) => setReason(event.target.value.replace(/[\r\n]+/g, ' '))}
onKeyDown={(event) => {
if (event.key === 'Enter' && !event.shiftKey) {
event.preventDefault()
event.currentTarget.form?.requestSubmit()
}
}}
/>
<div className='cp4-meta'>
{reasonErr ? (
<p id={uid + '-rerr'} className='cp4-err'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{hasText ? text(copy.reasonShortError, vars) : copy.reasonEmptyError}
</p>
) : null}
<span
id={uid + '-count'}
className='cp4-count'
data-warn={warn ? '' : undefined}
data-limit={atLimit ? '' : undefined}
>
<span className='cp4-sr'>{copy.countLabel} </span>
{text(copy.count, vars)}
</span>
</div>
<span className='cp4-sr' aria-live='polite'>
{warn && !isDisabled ? text(copy.countWarn, vars) : ''}
</span>
</div>
{askName ? (
<div className='cp4-field'>
<label className='cp4-label' htmlFor={uid + '-name'}>
{copy.firstNameLabel}
</label>
<input
ref={nameRef}
id={uid + '-name'}
name='firstName'
type='text'
autoComplete='given-name'
className='cp4-control cp4-input'
value={nameValue}
disabled={isDisabled}
placeholder={copy.firstNamePlaceholder}
aria-invalid={nameErr || undefined}
aria-describedby={nameErr ? uid + '-nerr' : undefined}
onChange={(event) => setNameValue(event.target.value)}
/>
{nameErr ? (
<p id={uid + '-nerr'} className='cp4-err'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.nameError}
</p>
) : null}
</div>
) : null}
<div className='cp4-actions'>
<button
type='submit'
className='cp4-btn'
disabled={isDisabled || !hasText}
data-loading={loading || undefined}
aria-describedby={note ? uid + '-note' : undefined}
>
{loading ? (
<span className='cp4-btn-label'>
<Loader2 className='cp4-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
{copy.loadingLabel}
</span>
) : (
<>
<span className='cp4-btn-label'>{copy.label}</span>
<span className='cp4-btn-sub'>{copy.sublabel}</span>
</>
)}
</button>
{note ? (
<p id={uid + '-note'} className='cp4-note'>
{note}
</p>
) : null}
</div>
</form>
{readBack ? (
<div className='cp4-pace cp4-tile' style={{ '--i': 2 } as React.CSSProperties}>
<Spot src={calendar} size={72} />
<h3 className='cp4-pace-title'>{readBack.title}</h3>
<p className='cp4-pace-line'>{readBack.line}</p>
</div>
) : null}
{sceneImage ? (
<figure className='cp4-photo cp4-tile' style={{ '--i': 3 } as React.CSSProperties}>
<img src={sceneImage} alt={sceneAlt} loading='lazy' decoding='async' />
</figure>
) : null}
</div>
</div>
</section>
)
}
export default CommitmentPledge4
const defaultCopy = {
headlineLead: 'Write the',
headlineMark: 'one line',
headlineTail: 'that carries you to the finish',
leadBold: 'Your why, in print.',
lead: 'Type the reason you joined and watch it set as your pledge, signed with your name.',
formTitle: 'Why are you doing this?',
reasonLabel: 'Your reason, in one line',
reasonPlaceholder: 'So I can stop waiting on referrals and fill my own calendar.',
countLabel: 'Characters used:',
count: '{count} / {max}',
countWarn: '{left} characters left',
firstNameLabel: 'Sign it with your first name',
firstNamePlaceholder: 'Dana',
emptyPrompt: 'Your words set here, in print, as you type.',
attribution: '{firstName}, {eventName}',
attributionNoEvent: '{firstName}',
youFallback: 'You',
label: 'Lock In My Why',
sublabel: 'Signed with your first name',
loadingLabel: 'Locking it in\u2026',
lockedNote: 'Write your line to unlock the button.',
disabledNote: 'Your pledge opens once your registration is confirmed.',
reasonEmptyError: 'Write your reason to continue.',
reasonShortError: 'Give it a few more words ({min} characters or more).',
nameError: 'Add your first name so your pledge is signed.',
}
function text(template: string, vars: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => (key in vars ? String(vars[key]) : match))
}
const CSS = `
.cf-commitment-pledge-4{position:relative;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);overflow-x:clip}
.cf-commitment-pledge-4 *,.cf-commitment-pledge-4 *::before,.cf-commitment-pledge-4 *::after{box-sizing:border-box}
.cf-commitment-pledge-4 .cp4-wrap{max-width:1120px;margin:0 auto}
.cf-commitment-pledge-4 .cp4-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-commitment-pledge-4 .cp4-head{max-width:46rem;margin:0 0 clamp(32px,4vw,48px)}
.cf-commitment-pledge-4 .cp4-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;text-wrap:balance;color:var(--ink)}
.cf-commitment-pledge-4 .cp4-em{color:var(--accent);white-space:nowrap}
.cf-commitment-pledge-4 .cp4-lead{margin:0;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
.cf-commitment-pledge-4 .cp4-lead strong{font-weight:800}
.cf-commitment-pledge-4 .cp4-grid{display:grid;gap:16px;grid-template-columns:repeat(12,minmax(0,1fr));grid-template-areas:"p p p p p p p f f f f f" "i i i i i i i n n n n n"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='photo']{grid-template-areas:"p p p p p p p f f f f f" "i i i i i i i i i i i i"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='pacing']{grid-template-areas:"p p p p p p p f f f f f" "n n n n n n n n n n n n"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='none']{grid-template-areas:"p p p p p p p f f f f f"}
.cf-commitment-pledge-4 .cp4-preview{grid-area:p;margin:0;display:flex;flex-direction:column;min-width:0;min-height:360px;border-radius:var(--card-radius,var(--radius,14px));background:var(--band);color:var(--band-ink);border:1px solid oklch(from var(--band-ink) l c h / 0.08);overflow:hidden;box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.22),0 12px 24px -8px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.32))}
.cf-commitment-pledge-4 .cp4-preview-in{position:relative;z-index:1;flex:1;display:flex;flex-direction:column;justify-content:space-between;gap:32px;padding:clamp(24px,4vw,48px)}
.cf-commitment-pledge-4 .cp4-quote{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.1;text-wrap:balance;overflow-wrap:anywhere;hanging-punctuation:first;color:var(--band-ink)}
.cf-commitment-pledge-4 .cp4-prompt{color:color-mix(in oklch,var(--band-ink) 78%,var(--band))}
.cf-commitment-pledge-4 .cp4-caret{display:inline-block;width:.07em;min-width:3px;height:.86em;margin-left:.08em;vertical-align:-.08em;border-radius:2px;background:var(--accent-fill,var(--accent));opacity:0;transition:opacity .16s ease}
.cf-commitment-pledge-4 .cp4-preview[data-focus] .cp4-caret{opacity:1}
.cf-commitment-pledge-4 .cp4-by{margin:0;display:flex;align-items:center;gap:12px;min-width:0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--band-ink);overflow-wrap:anywhere}
.cf-commitment-pledge-4 .cp4-rule{flex:none;width:32px;height:3px;border-radius:2px;background:var(--accent-fill,var(--accent))}
.cf-commitment-pledge-4 .cp4-form{grid-area:f;min-width:0;display:flex;flex-direction:column;gap:20px;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.22),0 4px 10px -2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.2)));padding:clamp(20px,3vw,32px)}
.cf-commitment-pledge-4 .cp4-form-title,.cf-commitment-pledge-4 .cp4-pace-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-0.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance}
.cf-commitment-pledge-4 .cp4-field{display:flex;flex-direction:column;gap:8px}
.cf-commitment-pledge-4 .cp4-label{font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink))}
.cf-commitment-pledge-4 .cp4-control{display:block;width:100%;margin:0;background:var(--field);color:var(--field-ink);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));font-family:var(--font-body);font-size:17px;line-height:1.45;padding:14px 16px;transition:border-color .16s ease,box-shadow .16s ease}
.cf-commitment-pledge-4 .cp4-input{height:56px;padding-block:0}
.cf-commitment-pledge-4 .cp4-textarea{min-height:120px;resize:none}
.cf-commitment-pledge-4 .cp4-control::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-commitment-pledge-4 .cp4-control:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink) 38%,transparent)}
.cf-commitment-pledge-4 .cp4-control:focus{outline:none}
.cf-commitment-pledge-4 .cp4-control:focus-visible{border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.35)}
.cf-commitment-pledge-4 .cp4-control[aria-invalid='true']{border-color:var(--danger)}
.cf-commitment-pledge-4 .cp4-control[aria-invalid='true']:focus-visible{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.3)}
.cf-commitment-pledge-4 .cp4-control:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink) 5%,var(--field))}
.cf-commitment-pledge-4 .cp4-meta{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-height:20px}
.cf-commitment-pledge-4 .cp4-count{margin-left:auto;flex:none;font-size:.875rem;font-weight:800;line-height:1.4;font-variant-numeric:tabular-nums;color:var(--muted)}
.cf-commitment-pledge-4 .cp4-count[data-warn]{color:var(--warning)}
.cf-commitment-pledge-4 .cp4-count[data-limit]{color:var(--danger)}
.cf-commitment-pledge-4 .cp4-err{margin:0;min-width:0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-commitment-pledge-4 .cp4-err svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-commitment-pledge-4 .cp4-actions{display:flex;flex-direction:column;gap:12px;margin-top:4px}
.cf-commitment-pledge-4 .cp4-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;min-height:72px;margin:0;padding:10px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);text-transform:var(--button-case,none);text-align:center;cursor:pointer;background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.3),0 8px 16px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.35));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-commitment-pledge-4 .cp4-btn-label{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15}
.cf-commitment-pledge-4 .cp4-btn-sub{font-family:var(--font-body);font-size:.9375rem;font-weight:500;line-height:1.3;text-wrap:pretty;text-transform:none}
.cf-commitment-pledge-4 .cp4-btn:not(:disabled):hover,.cf-commitment-pledge-4[data-force='hover'] .cp4-btn:not(:disabled){background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.2) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.34),0 10px 18px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.42))}
.cf-commitment-pledge-4 .cp4-btn:not(:disabled):active,.cf-commitment-pledge-4[data-force='active'] .cp4-btn:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.1) c h));box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - 0.24) c h / 0.6),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.18) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.3)}
.cf-commitment-pledge-4 .cp4-btn:focus{outline:none}
.cf-commitment-pledge-4 .cp4-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-commitment-pledge-4 .cp4-btn[data-loading]{cursor:progress}
.cf-commitment-pledge-4 .cp4-btn:disabled{cursor:not-allowed;background:var(--secondary);color:var(--secondary-ink);text-shadow:none;box-shadow:none}
.cf-commitment-pledge-4 .cp4-note{margin:0;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted);text-align:center;text-wrap:pretty}
.cf-commitment-pledge-4 .cp4-pace{grid-area:n;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:clamp(20px,3vw,32px);border-radius:var(--card-radius,var(--radius,14px));background:color-mix(in oklch,var(--ink) 5%,var(--surface));color:var(--ink)}
.cf-commitment-pledge-4 .cp4-pace-line{margin:0;max-width:60ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-commitment-pledge-4 .cp4-pace-line strong{font-weight:800}
.cf-commitment-pledge-4 .cp4-photo{grid-area:i;position:relative;margin:0;min-width:0;min-height:240px;border-radius:12px;overflow:hidden;background:color-mix(in oklch,var(--ink) 6%,var(--surface))}
.cf-commitment-pledge-4 .cp4-photo img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;object-position:center 45%}
@media (max-width:899px){
.cf-commitment-pledge-4 .cp4-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:"p p" "f f" "i n"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='photo']{grid-template-areas:"p p" "f f" "i i"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='pacing']{grid-template-areas:"p p" "f f" "n n"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='none']{grid-template-areas:"p p" "f f"}
.cf-commitment-pledge-4 .cp4-preview{min-height:300px}
}
@media (max-width:599px){
.cf-commitment-pledge-4 .cp4-grid,.cf-commitment-pledge-4 .cp4-grid[data-lower]{gap:12px;grid-template-columns:minmax(0,1fr)}
.cf-commitment-pledge-4 .cp4-grid[data-lower='both']{grid-template-areas:"p" "f" "n" "i"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='photo']{grid-template-areas:"p" "f" "i"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='pacing']{grid-template-areas:"p" "f" "n"}
.cf-commitment-pledge-4 .cp4-grid[data-lower='none']{grid-template-areas:"p" "f"}
.cf-commitment-pledge-4 .cp4-preview{min-height:200px}
.cf-commitment-pledge-4 .cp4-preview-in{gap:24px}
.cf-commitment-pledge-4 .cp4-quote{font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.2}
.cf-commitment-pledge-4 .cp4-photo{min-height:0;aspect-ratio:4/3}
}
@keyframes cp4-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cp4-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:no-preference){
.cf-commitment-pledge-4 .cp4-tile{animation:cp4-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0) * .07s)}
.cf-commitment-pledge-4 .cp4-spin{animation:cp4-spin .8s linear infinite}
}
@media (prefers-reduced-motion:reduce){
.cf-commitment-pledge-4 *,.cf-commitment-pledge-4 *::before,.cf-commitment-pledge-4 *::after{animation:none!important;transition:none!important}
.cf-commitment-pledge-4 .cp4-btn:not(:disabled):active{transform:none}
}
`
pieces/forms/commitment-pledge-4/specimen.tsx 40 lines
import __studioImage6cd82a48 from "../assets/ccb1deac42f1dc68.webp";
import * as React from 'react'
import { CommitmentPledge4 } from '../commitment-pledge-4'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled' | 'error'
const SAMPLE_REASON = 'So I can stop waiting on referrals and land my first 10 clients on purpose.'
export default function CommitmentPledge4Specimen({ state = 'default' }: { state?: SpecimenState }) {
const filled = state === 'hover' || state === 'active'
const reason = filled ? SAMPLE_REASON : state === 'error' ? 'Freedom' : ''
const name = filled ? 'Dana' : ''
return (
<CommitmentPledge4
state={state}
eventName='First 10 Clients Challenge'
defaultReason={reason}
defaultFirstName={name}
readBack={{
title: 'You\u2019ll read this back on Day 5',
line: (
<>
<strong>On the final day,</strong> you’ll read your line out loud before the last session. Write it for that version of you.
</>
),
}}
sceneImage={slot(
'scene',
__studioImage6cd82a48
)}
sceneAlt='A hand writing a single line in an open notebook on a sunlit desk'
onSubmit={() => undefined}
/>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalCommitmentPledge4 |
Partial<CommitmentPledge4Copy> |
|
headline OptionalCommitmentPledge4 |
React.ReactNode |
|
eventName OptionalCommitmentPledge4 |
string |
|
firstName OptionalCommitmentPledge4 |
string |
|
defaultFirstName OptionalCommitmentPledge4 |
string |
Default ''
|
defaultReason OptionalCommitmentPledge4 |
string |
Default ''
|
maxLength OptionalCommitmentPledge4 |
number |
Default 100
|
minLength OptionalCommitmentPledge4 |
number |
Default 10
|
readBack OptionalCommitmentPledge4 |
{ title: string; line: React.ReactNode } |
|
sceneImage OptionalCommitmentPledge4 |
string |
|
sceneAlt OptionalCommitmentPledge4 |
string |
Default ''
|
disabled OptionalCommitmentPledge4 |
boolean |
Default false
|
state OptionalCommitmentPledge4 |
CommitmentPledge4State |
Default 'default'
|
onSubmit OptionalCommitmentPledge4 |
(pledge: { reason: string; firstName: string }) => void | Promise<void> |
|
className OptionalCommitmentPledge4 |
string |
|
style OptionalCommitmentPledge4 |
React.CSSProperties |
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.
--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.
scene- A wide atmosphere photo behind or beside the copy.
-
2c539f422023a290.webp
image/webp · 115 KB
-
321240b3188e2da4.webp
image/webp · 18.7 KB
-
ccb1deac42f1dc68.webp
image/webp · 55.6 KB