Progress Bar Header 2
Almost-done OTO header: a dark band with the logo, a striped route that fills once from the last step to this one,
Use it in a prompt
Use hero/progress-bar-header-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/hero/progress-bar-header-2.tsx. - Import it and pass your copy and images (Props tab):
import { ProgressBarHeader2 } from "@/components/funneldna/hero/progress-bar-header-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/progress-bar-header-2/component.tsx 418 lines
// layout: route-map
// Almost-done OTO header: a dark band with the logo, a striped route that fills once from the last step to this one,
// one bold completion line and a recap of what the buyer already has, so the one decision left feels true and close.
import * as React from 'react'
import { Check, ChevronDown } from 'lucide-react'
import { Pattern, FX_HOST } from '../fx/fx'
export type ProgressBarHeader2Step = {
label: string
}
export type ProgressBarHeader2Item = {
name: string
/** Quiet second part of the chip, e.g. "30 servings". */
detail?: string
}
export type ProgressBarHeader2State = 'default' | 'hover' | 'active'
export type ProgressBarHeader2Props = {
/** Logo mark on a transparent background (slot logo). */
logoImage?: string
logoAlt?: string
/** Wordmark beside the logo; empty shows the image alone. */
brand?: string
/** The one bold line. */
headline?: string
/** Short line after the step counter. */
note?: string
/** Step counter; placeholders {current} and {total}. */
stepTemplate?: string
/** Funnel steps in order; each milestone sits at the end of its share of the route. */
steps?: ProgressBarHeader2Step[]
/** Step the buyer is on, 1-based. */
current?: number
/** This step's fill 0-100; defaults to current / steps. */
percent?: number
/** Where the fill starts its one animation; defaults to the previous step. */
previousPercent?: number
/** Word after the big percent. */
percentSuffix?: string
/** Short line before the recap chips. */
recapLead?: string
/** What the buyer already has in this order. */
items?: ProgressBarHeader2Item[]
/** Chips shown before the "+N more" disclosure on wide screens. */
visibleItems?: number
/** Disclosure label; placeholder {count}. */
moreTemplate?: string
lessLabel?: string
/** Phone summary chip; placeholder {count}. */
summaryTemplate?: string
/** Phone summary chip for a single item; placeholder {count}. */
summaryTemplateOne?: string
defaultExpanded?: boolean
/** hover previews the disclosure hover; active shows the recap opened. */
state?: ProgressBarHeader2State
copy?: {
/** Accessible name of the header. */
region?: string
/** Accessible name of the bar. */
progressLabel?: string
/** Spoken bar value; placeholders {step} and {percent}. */
progressValue?: string
/** Accessible name of the step list. */
stepsLabel?: string
/** Screen-reader note on finished steps. */
done?: string
/** Screen-reader end of the "+N more" label. */
moreHint?: string
}
className?: string
}
const DEFAULT_STEPS: ProgressBarHeader2Step[] = [
{ label: 'Order placed' },
{ label: 'Your one-time offer' },
{ label: 'Order complete' },
]
const DEFAULT_ITEMS: ProgressBarHeader2Item[] = [
{ name: 'Funnel Planning Guide' },
{ name: 'Page Copy Workbook' },
{ name: 'Launch Checklist' },
]
export function ProgressBarHeader2(props: ProgressBarHeader2Props) {
const {
logoImage,
logoAlt = 'Logo',
brand = 'The Funnel Starter Kit',
headline = 'Your order is almost complete',
note = 'One decision left, then your order is complete.',
stepTemplate = 'Step {current} of {total}',
steps = DEFAULT_STEPS,
current: currentProp = 2,
percent: percentProp,
previousPercent,
percentSuffix = 'complete',
recapLead = 'You already have:',
items = DEFAULT_ITEMS,
visibleItems = 2,
moreTemplate = '+{count} more',
lessLabel = 'Show less',
summaryTemplate = '{count} items in your order',
summaryTemplateOne = '{count} item in your order',
defaultExpanded = false,
state = 'default',
copy,
className,
} = props
const text = {
region: 'Order progress',
progressLabel: 'Order progress',
progressValue: '{step}, {percent}% complete',
stepsLabel: 'Order steps',
done: '(done)',
moreHint: 'in your order',
...copy,
}
const listId = React.useId()
const [open, setOpen] = React.useState(defaultExpanded || state === 'active')
React.useEffect(() => {
setOpen(defaultExpanded || state === 'active')
}, [state, defaultExpanded])
const count = Math.max(steps.length, 1)
const cur = Math.min(Math.max(Math.round(currentProp), 1), count)
const to = clampPercent(percentProp ?? (cur / count) * 100)
const from = Math.min(clampPercent(previousPercent ?? ((cur - 1) / count) * 100), to)
const counter = fill(stepTemplate, { current: cur, total: count })
const valueText = fill(text.progressValue, { step: counter, percent: to })
const visible = Math.max(0, Math.floor(visibleItems))
const extra = Math.max(items.length - visible, 0)
const force = state === 'hover' || state === 'active' ? state : undefined
const summary = fill(items.length === 1 ? summaryTemplateOne : summaryTemplate, { count: items.length })
const more = fill(moreTemplate, { count: extra })
const toggle = () => setOpen((value) => !value)
const rootStyle = { '--pbh2-from': `${from}%`, '--pbh2-to': `${to}%` } as React.CSSProperties
const stepState = (index: number) => (index + 1 < cur ? 'done' : index + 1 === cur ? 'current' : 'next')
return (
<header
className={['cf-pbh2', className].filter(Boolean).join(' ')}
data-open={open ? 'true' : 'false'}
style={rootStyle}
aria-label={text.region}
>
<style>{CSS}</style>
<div className='cf-pbh2__inner'>
<div className='cf-pbh2__logo'>
{logoImage ? (
<img className='cf-pbh2__logo-img' src={logoImage} alt={brand ? '' : logoAlt} width={40} height={40} />
) : null}
{brand ? <span className='cf-pbh2__brand'>{brand}</span> : null}
</div>
<div className='cf-pbh2__copy'>
<p className='cf-pbh2__line'>{headline}</p>
<p className='cf-pbh2__note'>
<strong>{counter}</strong>
{note ? (
<>
<span className='cf-pbh2__sep' aria-hidden='true'>·</span>
{note}
</>
) : null}
</p>
</div>
<p className='cf-pbh2__pct' aria-hidden='true'>
<span className='cf-pbh2__num'>{`${to}%`}</span>
<span className='cf-pbh2__suffix'>{percentSuffix}</span>
</p>
<div className='cf-pbh2__route' style={FX_HOST}>
<Pattern name='hatch' fade='edges' />
<div className='cf-pbh2__rail'>
<div
className='cf-pbh2__track'
role='progressbar'
aria-label={text.progressLabel}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={to}
aria-valuetext={valueText}
>
<span className='cf-pbh2__fill' aria-hidden='true' />
{steps.map((step, index) => {
const kind = stepState(index)
return (
<span
key={`${step.label}-${index}`}
className='cf-pbh2__dot'
data-step={kind}
style={{ '--pos': `${((index + 1) / count) * 100}%` } as React.CSSProperties}
aria-hidden='true'
>
{kind === 'done' ? <Check size={14} strokeWidth={3} /> : null}
</span>
)
})}
</div>
<ol className='cf-pbh2__steps' aria-label={text.stepsLabel} style={{ '--n': count } as React.CSSProperties}>
{steps.map((step, index) => {
const kind = stepState(index)
return (
<li
key={`${step.label}-${index}`}
className='cf-pbh2__step'
data-step={kind}
aria-current={kind === 'current' ? 'step' : undefined}
>
{step.label}
{kind === 'done' ? <span className='cf-pbh2__sr'> {text.done}</span> : null}
</li>
)
})}
</ol>
</div>
</div>
{items.length > 0 ? (
<div className='cf-pbh2__recap'>
{recapLead ? <p className='cf-pbh2__lead'>{recapLead}</p> : null}
<button
type='button'
className='cf-pbh2__toggle cf-pbh2__summary'
aria-expanded={open}
aria-controls={listId}
data-force={force}
onClick={toggle}
>
<span className='cf-pbh2__tick' aria-hidden='true'>
<Check size={12} strokeWidth={3} />
</span>
<span>{summary}</span>
<ChevronDown className='cf-pbh2__chev' size={16} strokeWidth={2.5} aria-hidden='true' />
</button>
<ul id={listId} className='cf-pbh2__chips'>
{items.map((item, index) => (
<li key={`${item.name}-${index}`} className={'cf-pbh2__chip' + (index >= visible ? ' is-extra' : '')}>
<span className='cf-pbh2__tick' aria-hidden='true'>
<Check size={12} strokeWidth={3} />
</span>
<span className='cf-pbh2__chip-text'>
<span className='cf-pbh2__chip-name'>{item.name}</span>
{item.detail ? (
<>
<span className='cf-pbh2__sep' aria-hidden='true'>·</span>
<span className='cf-pbh2__chip-detail'>{item.detail}</span>
</>
) : null}
</span>
</li>
))}
</ul>
{extra > 0 ? (
<button
type='button'
className='cf-pbh2__toggle cf-pbh2__more'
aria-expanded={open}
aria-controls={listId}
data-force={force}
onClick={toggle}
>
<span>{open ? lessLabel : more}</span>
{!open && text.moreHint ? <span className='cf-pbh2__sr'> {text.moreHint}</span> : null}
<ChevronDown className='cf-pbh2__chev' size={16} strokeWidth={2.5} aria-hidden='true' />
</button>
) : null}
</div>
) : null}
</div>
</header>
)
}
export default ProgressBarHeader2
function clampPercent(value: number) {
if (!Number.isFinite(value)) return 0
return Math.round(Math.min(100, Math.max(0, value)))
}
function fill(template: string, values: Record<string, string | number>) {
let out = template
for (const key of Object.keys(values)) out = out.split('{' + key + '}').join(String(values[key]))
return out
}
// The tick glyph inside solid status badges is white by contract (theme-contract: status icon badges).
const CSS = `
.cf-pbh2{
--pbh2-fill:var(--progress-fill,var(--accent-fill,var(--accent,oklch(0.5 0.17 257))));
--pbh2-fill-2:oklch(from var(--pbh2-fill) calc(l + 0.08) c h);
--pbh2-ink:var(--band-ink,oklch(1 0 0));
--pbh2-bg:var(--band,oklch(0.27 0.067 256));
--pbh2-soft:color-mix(in oklch,var(--pbh2-ink) 82%,var(--pbh2-bg));
--pbh2-glyph:var(--status-glyph,#fff);
--pbh2-gutter:clamp(16px,5vw,48px);
position:relative;width:100%;
background:var(--pbh2-bg);color:var(--pbh2-ink);
font-family:var(--font-body,system-ui,sans-serif);line-height:1.4;
box-shadow:inset 0 -1px 0 oklch(from var(--pbh2-ink) l c h / 0.1);
}
.cf-pbh2 *,.cf-pbh2 *::before,.cf-pbh2 *::after{box-sizing:border-box}
.cf-pbh2 :where(p,ol,ul,li){margin:0;padding:0}
.cf-pbh2 :where(ol,ul){list-style:none}
.cf-pbh2__inner{
display:grid;grid-template-columns:auto minmax(0,1fr) auto;
grid-template-areas:'logo copy pct' 'route route route' 'recap recap recap';
align-items:center;column-gap:clamp(16px,3vw,32px);
max-width:calc(1120px + 2 * var(--pbh2-gutter));margin-inline:auto;
padding:20px var(--pbh2-gutter) 20px;
}
.cf-pbh2__logo{grid-area:logo;display:flex;align-items:center;gap:10px;min-width:0}
.cf-pbh2__logo-img{display:block;width:40px;height:40px;flex:none;object-fit:contain;border-radius:0;
filter:drop-shadow(0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.35))}
.cf-pbh2__brand{font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);
font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.15;letter-spacing:-0.01em;text-wrap:balance}
.cf-pbh2__copy{grid-area:copy;min-width:0}
.cf-pbh2__line{font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);
text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;
letter-spacing:-0.01em;text-wrap:balance}
.cf-pbh2__note{margin-top:8px;font-size:0.9375rem;font-weight:500;line-height:1.4;color:var(--pbh2-soft);text-wrap:pretty}
.cf-pbh2__note strong{font-weight:800;color:var(--pbh2-ink)}
.cf-pbh2__sep{display:inline-block;margin-inline:8px}
.cf-pbh2__pct{grid-area:pct;justify-self:end;display:flex;align-items:baseline;gap:8px;white-space:nowrap}
.cf-pbh2__num{font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);
font-size:clamp(2rem,3.6vw,3.25rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-pbh2__suffix{font-size:0.9375rem;font-weight:600;color:var(--pbh2-soft)}
.cf-pbh2__route{grid-area:route;margin-top:16px;padding-block:12px;color:var(--pbh2-ink)}
.cf-pbh2__rail{position:relative;padding-inline-end:14px}
.cf-pbh2__track{position:relative;height:14px;border-radius:999px;
background:oklch(from var(--pbh2-ink) l c h / 0.12);
box-shadow:inset 0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.45),inset 0 0 0 1px oklch(from var(--pbh2-ink) l c h / 0.16)}
.cf-pbh2__fill{position:absolute;inset:0;border-radius:inherit;
background:repeating-linear-gradient(-45deg,var(--pbh2-fill) 0 10px,var(--pbh2-fill-2) 10px 20px);
box-shadow:inset 0 1px 0 oklch(from var(--pbh2-fill) calc(l + 0.16) c h / 0.7),inset 0 -2px 0 oklch(from var(--pbh2-fill) calc(l - 0.12) c h);
clip-path:inset(0 calc(100% - var(--pbh2-to)) 0 0 round 999px)}
.cf-pbh2__dot{position:absolute;top:50%;left:var(--pos);z-index:1;display:grid;place-items:center;
width:26px;height:26px;border-radius:999px;transform:translate(-50%,-50%);
background:var(--pbh2-bg);border:2px solid oklch(from var(--pbh2-ink) l c h / 0.45)}
.cf-pbh2__dot[data-step='done']{background:var(--success,oklch(0.5 0.14 150));border:3px solid var(--pbh2-bg);color:var(--pbh2-glyph)}
.cf-pbh2__dot[data-step='current']{width:28px;height:28px;border:3px solid var(--pbh2-fill)}
.cf-pbh2__dot[data-step='current']::after{content:'';width:10px;height:10px;border-radius:999px;background:var(--pbh2-ink)}
.cf-pbh2__steps{display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));margin-top:12px}
.cf-pbh2__step{margin-inline-end:-14px;padding-inline-start:8px;text-align:end;font-size:0.9375rem;font-weight:600;
line-height:1.3;color:var(--pbh2-soft);text-wrap:balance}
.cf-pbh2__step[data-step='current']{font-weight:800;color:var(--pbh2-ink)}
.cf-pbh2__recap{grid-area:recap;display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;margin-top:12px}
.cf-pbh2__lead{font-size:0.9375rem;font-weight:600;color:var(--pbh2-soft);margin-inline-end:4px}
.cf-pbh2__chips{display:flex;flex-wrap:wrap;gap:8px}
.cf-pbh2__chip{display:inline-flex;align-items:center;gap:8px;min-height:32px;padding:4px 12px 4px 6px;border-radius:999px;
background:oklch(from var(--pbh2-ink) l c h / 0.1);box-shadow:inset 0 0 0 1px oklch(from var(--pbh2-ink) l c h / 0.12);
font-size:0.875rem;font-weight:700;line-height:1.2;white-space:nowrap}
.cf-pbh2[data-open='false'] .cf-pbh2__chip.is-extra{display:none}
.cf-pbh2__chip .cf-pbh2__sep{margin-inline:6px}
.cf-pbh2__chip-detail{font-weight:500;color:var(--pbh2-soft)}
.cf-pbh2__tick{display:grid;place-items:center;flex:none;width:20px;height:20px;border-radius:999px;
background:var(--success,oklch(0.5 0.14 150));color:var(--pbh2-glyph)}
.cf-pbh2__toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:36px;padding:4px 12px;
border:1px solid oklch(from var(--pbh2-ink) l c h / 0.34);border-radius:999px;
background:oklch(from var(--pbh2-ink) l c h / 0.06);color:var(--pbh2-ink);
font:inherit;font-size:0.875rem;font-weight:800;line-height:1.2;cursor:pointer;
transition:background .16s ease,border-color .16s ease,transform .16s ease}
.cf-pbh2__toggle:hover,.cf-pbh2__toggle[data-force='hover']{background:oklch(from var(--pbh2-ink) l c h / 0.14);border-color:oklch(from var(--pbh2-ink) l c h / 0.52)}
.cf-pbh2__toggle:active,.cf-pbh2__toggle[data-force='active']{background:oklch(from var(--pbh2-ink) l c h / 0.2);transform:translateY(1px)}
.cf-pbh2__toggle:focus-visible{outline:2px solid var(--pbh2-ink);outline-offset:3px}
.cf-pbh2__chev{flex:none;transition:transform .16s ease}
.cf-pbh2__toggle[aria-expanded='true'] .cf-pbh2__chev{transform:rotate(180deg)}
.cf-pbh2__summary{display:none;padding-inline-start:6px}
.cf-pbh2__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@keyframes cf-pbh2-fill{
from{clip-path:inset(0 calc(100% - var(--pbh2-from)) 0 0 round 999px)}
to{clip-path:inset(0 calc(100% - var(--pbh2-to)) 0 0 round 999px)}
}
@keyframes cf-pbh2-pop{
from{transform:translate(-50%,-50%) scale(.9)}
to{transform:translate(-50%,-50%) scale(1)}
}
@media (prefers-reduced-motion:no-preference){
.cf-pbh2__fill{animation:cf-pbh2-fill .9s cubic-bezier(.2,.7,.2,1) .25s both}
.cf-pbh2__dot[data-step='current']{animation:cf-pbh2-pop .3s cubic-bezier(.2,.7,.2,1) 1.1s both}
}
@media (prefers-reduced-motion:reduce){
.cf-pbh2__toggle,.cf-pbh2__chev{transition:none}
.cf-pbh2__toggle:active,.cf-pbh2__toggle[data-force='active']{transform:none}
}
@media (pointer:coarse){.cf-pbh2__toggle{min-height:44px}}
@media (max-width:640px){
.cf-pbh2__inner{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'logo pct' 'copy copy' 'route route' 'recap recap';
column-gap:16px;padding:14px var(--pbh2-gutter) 16px}
.cf-pbh2__logo-img{width:36px;height:36px}
.cf-pbh2__copy{margin-top:12px}
.cf-pbh2__num{font-size:2rem}
.cf-pbh2__route{margin-top:8px;padding-block:10px}
.cf-pbh2__track{height:12px}
.cf-pbh2__fill{background:repeating-linear-gradient(-45deg,var(--pbh2-fill) 0 8px,var(--pbh2-fill-2) 8px 16px)}
.cf-pbh2__steps{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-pbh2__recap{margin-top:4px}
.cf-pbh2__lead,.cf-pbh2__more{display:none}
.cf-pbh2__summary{display:inline-flex}
.cf-pbh2__chips{display:none}
.cf-pbh2[data-open='true'] .cf-pbh2__chips{display:flex;flex-direction:column;align-items:flex-start;width:100%}
.cf-pbh2__chip{white-space:normal;max-width:100%}
}
@media (forced-colors:active){
.cf-pbh2__track{border:1px solid CanvasText}
.cf-pbh2__fill{background:Highlight}
.cf-pbh2__dot,.cf-pbh2__tick{border:1px solid CanvasText}
.cf-pbh2__toggle{border-color:ButtonText}
}
`
pieces/hero/progress-bar-header-2/specimen.tsx 35 lines
import __studioImageeb40d5d3 from "../assets/4ad1972372724d3e.webp";
import { ProgressBarHeader2 } from '../progress-bar-header-2'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active']
type SpecimenState = 'default' | 'hover' | 'active'
export default function ProgressBarHeader2Specimen({ state = 'default' }: { state?: SpecimenState }) {
return (
<ProgressBarHeader2
state={state}
logoImage={slot(
'logo',
__studioImageeb40d5d3,
)}
logoAlt='Northfield Greens'
brand='Northfield Greens'
headline='Your order is almost complete'
note='One decision left, then your greens are on their way.'
steps={[{ label: 'Order placed' }, { label: 'Your one-time offer' }, { label: 'Order complete' }]}
current={2}
previousPercent={33}
percent={67}
recapLead='Already in your order:'
items={[
{ name: 'Daily Greens Superfood Blend', detail: '30 servings' },
{ name: 'Stainless Shaker Bottle' },
{ name: 'Morning Recipe Cards', detail: '12 cards' },
{ name: 'Travel Stick Packs', detail: '7 packs' },
]}
visibleItems={2}
/>
)
}
| Name | Type | Details |
|---|---|---|
logoImage OptionalProgressBarHeader2 |
string |
|
logoAlt OptionalProgressBarHeader2 |
string |
|
brand OptionalProgressBarHeader2 |
string |
|
headline OptionalProgressBarHeader2 |
string |
|
note OptionalProgressBarHeader2 |
string |
|
stepTemplate OptionalProgressBarHeader2 |
string |
|
steps OptionalProgressBarHeader2 |
ProgressBarHeader2Step[] |
|
current OptionalProgressBarHeader2 |
number |
|
percent OptionalProgressBarHeader2 |
number |
|
previousPercent OptionalProgressBarHeader2 |
number |
|
percentSuffix OptionalProgressBarHeader2 |
string |
|
recapLead OptionalProgressBarHeader2 |
string |
|
items OptionalProgressBarHeader2 |
ProgressBarHeader2Item[] |
|
visibleItems OptionalProgressBarHeader2 |
number |
|
moreTemplate OptionalProgressBarHeader2 |
string |
|
lessLabel OptionalProgressBarHeader2 |
string |
|
summaryTemplate OptionalProgressBarHeader2 |
string |
|
summaryTemplateOne OptionalProgressBarHeader2 |
string |
|
defaultExpanded OptionalProgressBarHeader2 |
boolean |
|
state OptionalProgressBarHeader2 |
ProgressBarHeader2State |
|
copy OptionalProgressBarHeader2 |
{
/** Accessible name of the header. */
region?: string
/** Accessible name of the bar. */
progressLabel?: string
/** Spoken bar value; placeholders {step} and {percent}. */
progressValue?: string
/** Accessible name of the step list. */
stepsLabel?: string
/** Screen-reader note on finished steps. */
done?: string
/** Screen-reader end of the "+N more" label. */
moreHint?: string
} |
|
className OptionalProgressBarHeader2 |
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.
--display-case--display-weight- Headlines: weight, letter case and tracking.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
logo- The brand’s logo mark.
-
4ad1972372724d3e.webp
image/webp · 59.6 KB