Choice Cards
Cards to compare and pick, on real radio buttons or checkboxes, with a title, a line and an optional price. The picked card's ink border draws itself around it from the corner while a check draws in its mark. Pure CSS.
View codeOne real form cut into steps: Next checks the step first, the steps slide while the height eases, and the last one reads the answers back, each with its Edit. Sends via kodza:submit or a fetch.
With your AI
Say it to your AI. It gets the exact code below, not its best guess, and knows where it goes.
Add the Kodza Form Wizard to my page.
claude mcp add -t http kodza https://kodza.dev/api/mcp
<form class="kodza-wizard" action="#" method="post" data-next="Next" data-to-review="Back to review" data-sending="Sending…">
<ol class="kodza-wizard__steps">
<li class="kodza-wizard__step"><button class="kodza-wizard__dot" type="button"><span class="kodza-wizard__num">1</span><svg class="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-wizard__step-label">Project</span></li>
<li class="kodza-wizard__step"><button class="kodza-wizard__dot" type="button"><span class="kodza-wizard__num">2</span><svg class="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-wizard__step-label">Budget</span></li>
<li class="kodza-wizard__step"><button class="kodza-wizard__dot" type="button"><span class="kodza-wizard__num">3</span><svg class="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-wizard__step-label">Contact</span></li>
<li class="kodza-wizard__step"><button class="kodza-wizard__dot" type="button"><span class="kodza-wizard__num">4</span><svg class="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-wizard__step-label">Review</span></li>
</ol>
<div class="kodza-wizard__panels">
<fieldset class="kodza-wizard__panel">
<legend class="kodza-wizard__title">What are we building?</legend>
<fieldset class="kodza-wizard__group">
<legend class="kodza-wizard__legend">Project</legend>
<div class="kodza-wizard__choices">
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="project" value="site" required data-error="Pick one. Any one."><span>Marketing site</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="project" value="shop"><span>Online shop</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="project" value="redesign"><span>Redesign</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="project" value="unsure"><span>No idea yet</span></label>
</div>
<p class="kodza-wizard__note"><span class="kodza-wizard__hint">You can change your mind. We do it all the time.</span><span class="kodza-wizard__error" aria-live="polite"></span></p>
</fieldset>
<div class="kodza-wizard__field">
<label class="kodza-wizard__box">
<input class="kodza-wizard__input" type="url" name="current_site" placeholder=" " autocomplete="url" data-error="A full address, with https://.">
<span class="kodza-wizard__label">Current site</span>
</label>
<p class="kodza-wizard__note"><span class="kodza-wizard__hint">Optional. We will not judge it. Much.</span><span class="kodza-wizard__error" aria-live="polite"></span></p>
</div>
</fieldset>
<fieldset class="kodza-wizard__panel">
<legend class="kodza-wizard__title">What is the budget?</legend>
<fieldset class="kodza-wizard__group">
<legend class="kodza-wizard__legend">Budget</legend>
<div class="kodza-wizard__choices">
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="budget" value="under-5k" required data-error="A ballpark is fine. Nobody holds you to it."><span>Under €5k</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="budget" value="5-15k"><span>€5k to €15k</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="budget" value="over-15k"><span>Over €15k</span></label>
</div>
<p class="kodza-wizard__note"><span class="kodza-wizard__hint">A ballpark. Nobody holds you to it.</span><span class="kodza-wizard__error" aria-live="polite"></span></p>
</fieldset>
<fieldset class="kodza-wizard__group">
<legend class="kodza-wizard__legend">Launch</legend>
<div class="kodza-wizard__choices">
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="launch" value="asap" required data-error="Pick one. No rush is an answer too."><span>Yesterday</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="launch" value="quarter"><span>This quarter</span></label>
<label class="kodza-wizard__choice"><input class="kodza-wizard__radio" type="radio" name="launch" value="later"><span>No rush</span></label>
</div>
<p class="kodza-wizard__note"><span class="kodza-wizard__hint">Yesterday costs the same. It just ships later.</span><span class="kodza-wizard__error" aria-live="polite"></span></p>
</fieldset>
</fieldset>
<fieldset class="kodza-wizard__panel">
<legend class="kodza-wizard__title">Where do we send the quote?</legend>
<div class="kodza-wizard__field">
<label class="kodza-wizard__box">
<input class="kodza-wizard__input" type="text" name="name" placeholder=" " autocomplete="name" required data-error="We need something to call you.">
<span class="kodza-wizard__label">Name</span>
</label>
<p class="kodza-wizard__note"><span class="kodza-wizard__hint">A first name is plenty.</span><span class="kodza-wizard__error" aria-live="polite"></span></p>
</div>
<div class="kodza-wizard__field">
<label class="kodza-wizard__box">
<input class="kodza-wizard__input" type="email" name="email" placeholder=" " autocomplete="email" required data-error="That does not look like an email.">
<span class="kodza-wizard__label">Email</span>
</label>
<p class="kodza-wizard__note"><span class="kodza-wizard__hint">One email, with the quote. That is it.</span><span class="kodza-wizard__error" aria-live="polite"></span></p>
</div>
</fieldset>
<section class="kodza-wizard__panel kodza-wizard__review" hidden>
<h3 class="kodza-wizard__title">Check it. Then send it.</h3>
<dl class="kodza-wizard__summary"></dl>
</section>
<section class="kodza-wizard__panel kodza-wizard__done" hidden>
<h3 class="kodza-wizard__title">Sent.</h3>
<p class="kodza-wizard__text">A human reads it today. The quote lands in your inbox within two days, in plain numbers.</p>
</section>
</div>
<div class="kodza-wizard__actions">
<button class="kodza-wizard__back" type="button">Back</button>
<p class="kodza-wizard__status" aria-live="polite"></p>
<button class="kodza-wizard__next" type="submit">Send request</button>
</div>
</form>
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Form Wizard
One real form cut into steps, on the line of Stepper. Next checks the step first: the error
swaps in under the faulty field and the focus goes there. The card's height eases from one
step to the next while the old step leaves on one side and the new one comes in from the
other. Back keeps everything. The last step reads the answers back, each with an Edit that
jumps to its step (Next then returns straight to the review, and the changed answer rolls in).
Without JS, every step shows, one under the other, and the button sends the form.
The form is sent its own way (action, method). data-send="fetch" sends it without leaving
the page and shows .kodza-wizard__done; so does cancelling the kodza:submit event.
Everything is tuned with the --kz-wizard-* variables; the button words in data-* on the form. */
.kodza-wizard {
--kz-wizard-bg: #ffffff;
--kz-wizard-fg: #0a0a0a;
--kz-wizard-muted: rgba(10, 10, 10, 0.6);
--kz-wizard-border: rgba(10, 10, 10, 0.1);
--kz-wizard-line: rgba(10, 10, 10, 0.14);
--kz-wizard-line-hover: rgba(10, 10, 10, 0.3);
--kz-wizard-soft: rgba(10, 10, 10, 0.04);
--kz-wizard-ink: #0a0a0a;
--kz-wizard-on-ink: #ffffff;
--kz-wizard-error: #0a0a0a; /* a message, never colour alone: set a red here if you want one */
--kz-wizard-width: 560px;
--kz-wizard-dot: 28px;
--kz-wizard-field-height: 56px;
--kz-wizard-field-radius: calc(12px * var(--kz-radius-scale, 1));
--kz-wizard-duration: 0.6s; /* a step change; the field states take 2/3 of it */
--kz-wizard-ease: cubic-bezier(0.22, 1, 0.36, 1);
display: grid;
gap: 28px;
width: 100%;
max-width: var(--kz-wizard-width);
margin: 0;
padding: 28px;
border-radius: calc(16px * var(--kz-radius-scale, 1));
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1px var(--kz-wizard-border);
color: var(--kz-wizard-fg);
box-sizing: border-box;
}
/* The steps, and the line that joins their centres (once the script runs) */
.kodza-wizard__steps {
position: relative;
display: none;
grid-template-columns: repeat(var(--kz-wizard-n, 4), minmax(0, 1fr));
margin: 0;
padding: 0;
list-style: none;
}
.kodza-wizard.is-ready .kodza-wizard__steps {
display: grid;
}
.kodza-wizard__steps::before,
.kodza-wizard__steps::after {
content: "";
position: absolute;
top: calc(var(--kz-wizard-dot) / 2 - 1px);
left: calc(50% / var(--kz-wizard-n, 4));
right: calc(50% / var(--kz-wizard-n, 4));
height: 2px;
border-radius: calc(2px * var(--kz-radius-scale, 1));
background: var(--kz-wizard-line);
}
/* The filled part only scales */
.kodza-wizard__steps::after {
background: var(--kz-wizard-ink);
transform: scaleX(var(--kz-wizard-progress, 0));
transform-origin: left;
transition: transform calc(var(--kz-wizard-duration) * var(--kz-motion-scale, 1)) var(--kz-wizard-ease);
}
.kodza-wizard__step {
position: relative;
z-index: 1;
display: grid;
justify-items: center;
gap: 8px;
min-width: 0;
}
.kodza-wizard__dot {
position: relative;
display: grid;
place-items: center;
width: var(--kz-wizard-dot);
height: var(--kz-wizard-dot);
padding: 0;
border: 0;
border-radius: 50%;
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-line);
color: var(--kz-wizard-muted);
font: inherit;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, revert);
white-space: nowrap;
transition:
background-color calc(0.35s * var(--kz-motion-scale, 1)) ease,
box-shadow calc(0.35s * var(--kz-motion-scale, 1)) ease,
color calc(0.35s * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__dot:disabled {
cursor: default;
}
.kodza-wizard__dot:not(:disabled) {
cursor: pointer;
}
.kodza-wizard__dot:focus-visible {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 3px;
}
.kodza-wizard__step.is-current .kodza-wizard__dot,
.kodza-wizard__step.is-done .kodza-wizard__dot {
background: var(--kz-wizard-ink);
box-shadow: none;
color: var(--kz-wizard-on-ink);
}
.kodza-wizard__num,
.kodza-wizard__check {
grid-area: 1 / 1;
}
.kodza-wizard__num {
transition:
opacity calc(0.2s * var(--kz-motion-scale, 1)) ease,
transform calc(0.35s * var(--kz-motion-scale, 1)) var(--kz-wizard-ease);
}
.kodza-wizard__check {
width: 14px;
height: 14px;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 1;
stroke-dashoffset: 1;
transition: stroke-dashoffset calc(0.4s * var(--kz-motion-scale, 1)) var(--kz-wizard-ease);
}
/* A finished step: the number leaves, the check draws itself */
.kodza-wizard__step.is-done .kodza-wizard__num {
opacity: 0;
transform: scale(0.6);
}
.kodza-wizard__step.is-done .kodza-wizard__check {
stroke-dashoffset: 0;
transition-delay: calc(0.15s * var(--kz-motion-scale, 1));
}
.kodza-wizard__step-label {
max-width: 100%;
overflow: hidden;
color: var(--kz-wizard-muted);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 14px);
font-weight: var(--kz-font-label-weight, 500);
line-height: var(--kz-font-label-leading, 1.3);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-overflow: ellipsis;
text-transform: var(--kz-font-label-case, inherit);
white-space: nowrap;
transition: color calc(0.35s * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__step.is-current .kodza-wizard__step-label,
.kodza-wizard__step.is-done .kodza-wizard__step-label {
color: var(--kz-wizard-fg);
}
/* The steps. Without the script they all show, one under the other. With it, only the current
one is in the flow: the old one leaves on top of it (placed by the script) while the card's
height eases to the new one */
.kodza-wizard__panels {
position: relative;
display: grid;
gap: 36px;
}
.kodza-wizard__panel {
display: grid;
gap: 20px;
min-width: 0;
margin: 0;
padding: 0;
border: 0;
}
.kodza-wizard__panel[hidden],
.kodza-wizard.is-ready .kodza-wizard__panel:not(.is-current, .is-leaving) {
display: none;
}
.kodza-wizard.is-ready .kodza-wizard__panel.is-leaving {
position: absolute;
top: 0;
right: 0;
left: 0;
pointer-events: none;
}
.kodza-wizard__title {
float: left; /* a legend sits in the flow like any title */
width: 100%;
margin: 0;
padding: 0;
font-family: var(--kz-font-display, inherit);
font-size: calc(22px * var(--kz-font-display-scale, 1));
font-weight: var(--kz-font-display-weight, 600);
line-height: 1.2;
letter-spacing: var(--kz-font-display-tracking, -0.02em);
text-transform: var(--kz-font-display-case, inherit);
text-wrap: balance;
}
.kodza-wizard__title:focus {
outline: none;
}
.kodza-wizard__text {
margin: 0;
color: var(--kz-wizard-muted);
font-size: 15px;
line-height: 1.55;
text-wrap: pretty;
}
/* A group of answers (real radios), as pills that fill with ink */
.kodza-wizard__group {
display: grid;
gap: 10px;
min-width: 0;
margin: 0;
padding: 0;
border: 0;
}
.kodza-wizard__legend {
float: left;
width: 100%;
margin: 0;
padding: 0;
color: var(--kz-wizard-muted);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__choices {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.kodza-wizard__choice {
position: relative;
display: inline-flex;
align-items: center;
height: 40px;
padding: 0 18px;
border-radius: var(--kz-radius-pill, 999px);
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1px var(--kz-wizard-line);
color: var(--kz-wizard-fg);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 15px);
font-weight: var(--kz-font-label-weight, 500);
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
white-space: nowrap;
cursor: pointer;
box-sizing: border-box;
transition:
background-color calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease,
box-shadow calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease,
color calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease;
}
/* The radio stays real, under the pill, for the keyboard and the form */
.kodza-wizard__radio {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
margin: 0;
border-radius: inherit;
opacity: 0;
cursor: pointer;
}
@media (hover: hover) {
.kodza-wizard__choice:hover {
box-shadow: inset 0 0 0 1px var(--kz-wizard-line-hover);
}
}
.kodza-wizard__choice:has(.kodza-wizard__radio:checked) {
background: var(--kz-wizard-ink);
box-shadow: inset 0 0 0 1px var(--kz-wizard-ink);
color: var(--kz-wizard-on-ink);
}
.kodza-wizard__choice:has(.kodza-wizard__radio:focus-visible) {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 2px;
}
.kodza-wizard__group:has(.kodza-wizard__radio[aria-invalid="true"]) .kodza-wizard__choice {
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-error);
}
/* A text field: the box of Text Field, its label folds up once focused or filled */
.kodza-wizard__field {
display: grid;
gap: 8px;
min-width: 0;
}
.kodza-wizard__box {
position: relative;
display: flex;
align-items: flex-end;
height: var(--kz-wizard-field-height);
padding: 0 16px 9px;
border-radius: var(--kz-wizard-field-radius);
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1px var(--kz-wizard-line);
cursor: text;
box-sizing: border-box;
transition: box-shadow calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__box:hover {
box-shadow: inset 0 0 0 1px var(--kz-wizard-line-hover);
}
.kodza-wizard__box:focus-within {
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-ink), 0 0 0 4px var(--kz-wizard-soft);
}
.kodza-wizard__input {
flex: 1;
min-width: 0;
height: 22px;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
font-size: 15px;
line-height: 22px;
outline: none;
box-sizing: border-box;
}
.kodza-wizard__label {
position: absolute;
top: 50%;
left: 16px;
color: var(--kz-wizard-muted);
font-size: 15px;
line-height: 1;
white-space: nowrap;
pointer-events: none;
transform: translateY(-50%);
transform-origin: left top;
transition: transform calc(var(--kz-wizard-duration) * 0.58 * var(--kz-motion-scale, 1)) var(--kz-wizard-ease);
}
.kodza-wizard__box:focus-within .kodza-wizard__label,
.kodza-wizard__input:not(:placeholder-shown) ~ .kodza-wizard__label {
transform: translateY(-18px) scale(0.8);
}
.kodza-wizard__field:has(.kodza-wizard__input[aria-invalid="true"]) .kodza-wizard__box {
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-error);
}
/* The note under a field or a group: the hint and the error share one line, and swap */
.kodza-wizard__note {
display: grid;
margin: 0;
padding: 0 2px;
overflow: hidden;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, inherit);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__hint,
.kodza-wizard__error {
grid-area: 1 / 1;
transition:
opacity calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease,
transform calc(var(--kz-wizard-duration) * 0.67 * var(--kz-motion-scale, 1)) var(--kz-wizard-ease);
}
.kodza-wizard__hint {
color: var(--kz-wizard-muted);
}
.kodza-wizard__error {
display: flex;
align-items: center;
gap: 6px;
color: var(--kz-wizard-error);
font-weight: var(--kz-font-label-weight, 500);
opacity: 0;
transform: translateY(100%);
}
.kodza-wizard__error::before {
content: "";
flex: none;
width: 14px;
height: 14px;
background: currentColor;
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M8 4.5v4.2M8 10.9v.1' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M8 4.5v4.2M8 10.9v.1' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.kodza-wizard__note.is-invalid .kodza-wizard__hint {
opacity: 0;
transform: translateY(-100%);
}
.kodza-wizard__note.is-invalid .kodza-wizard__error {
opacity: 1;
transform: none;
}
/* The review: one line per answer, each with its Edit */
.kodza-wizard__summary {
display: grid;
margin: 0;
border-top: 1px solid var(--kz-wizard-border);
}
.kodza-wizard__row {
display: grid;
grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
align-items: center;
gap: 12px;
min-height: 48px;
padding: 6px 0;
border-bottom: 1px solid var(--kz-wizard-border);
box-sizing: border-box;
}
.kodza-wizard__row dt {
color: var(--kz-wizard-muted);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__row dd {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
margin: 0;
}
/* A changed answer rolls in: the old one goes up, the new one comes from below */
.kodza-wizard__value {
display: grid;
grid-template-columns: minmax(0, 1fr);
flex: 1;
min-width: 0;
overflow: hidden;
font-size: 15px;
line-height: 1.4;
}
.kodza-wizard__value > span {
grid-area: 1 / 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.kodza-wizard__edit {
flex: none;
height: 32px;
margin-right: -12px;
padding: 0 12px;
border: 0;
border-radius: var(--kz-radius-pill, 999px);
background: none;
color: var(--kz-wizard-fg);
font: inherit;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, revert);
text-transform: var(--kz-font-label-case, revert);
white-space: nowrap;
cursor: pointer;
transition: background-color calc(0.2s * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__edit:hover {
background: var(--kz-wizard-soft);
}
.kodza-wizard__edit:focus-visible {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 2px;
}
/* The buttons. Back waits off the first step; Next is the form's own submit button */
.kodza-wizard__actions {
display: flex;
align-items: center;
gap: 12px;
}
.kodza-wizard__status {
flex: 1;
min-width: 0;
margin: 0;
color: var(--kz-wizard-error);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-align: center;
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__back,
.kodza-wizard__next {
flex: none;
height: 40px;
padding: 0 20px;
border: 0;
border-radius: var(--kz-radius-pill, 999px);
font: inherit;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 15px);
font-weight: var(--kz-font-label-weight, 500);
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, revert);
text-transform: var(--kz-font-label-case, revert);
white-space: nowrap;
cursor: pointer;
transition:
opacity calc(0.25s * var(--kz-motion-scale, 1)) ease,
box-shadow calc(0.25s * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__back {
display: none;
background: none;
box-shadow: inset 0 0 0 1px var(--kz-wizard-border);
color: var(--kz-wizard-fg);
}
.kodza-wizard.is-ready .kodza-wizard__back {
display: block;
}
.kodza-wizard__back:hover {
box-shadow: inset 0 0 0 1px var(--kz-wizard-muted);
}
.kodza-wizard__back:disabled {
opacity: 0;
pointer-events: none;
}
.kodza-wizard__next {
margin-left: auto;
background: var(--kz-wizard-ink);
color: var(--kz-wizard-on-ink);
}
.kodza-wizard__next[aria-busy="true"] {
cursor: progress;
}
.kodza-wizard__back:focus-visible,
.kodza-wizard__next:focus-visible {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 2px;
}
/* The button label rolls to its new word; the button keeps the width of the longest one */
.kodza-wizard__roll {
display: inline-grid;
overflow: hidden;
vertical-align: top;
}
.kodza-wizard__roll > span {
grid-area: 1 / 1;
}
/* Sent: the buttons have done their job */
.kodza-wizard.is-sent .kodza-wizard__actions {
display: none;
}
@media (prefers-reduced-motion: reduce) {
.kodza-wizard__steps::after,
.kodza-wizard__dot,
.kodza-wizard__num,
.kodza-wizard__check,
.kodza-wizard__step-label,
.kodza-wizard__choice,
.kodza-wizard__box,
.kodza-wizard__label,
.kodza-wizard__hint,
.kodza-wizard__error {
transition-duration: 0.01ms !important;
transition-delay: 0s !important;
}
}
/* Theming example — on a dark background:
.dark-section .kodza-wizard {
--kz-wizard-bg: #161616;
--kz-wizard-fg: #f2f2f0;
--kz-wizard-muted: rgba(242, 242, 240, 0.62);
--kz-wizard-border: rgba(255, 255, 255, 0.12);
--kz-wizard-line: rgba(255, 255, 255, 0.16);
--kz-wizard-line-hover: rgba(255, 255, 255, 0.32);
--kz-wizard-soft: rgba(255, 255, 255, 0.07);
--kz-wizard-ink: #f2f2f0;
--kz-wizard-on-ink: #161616;
--kz-wizard-error: #f2f2f0;
}
*/
/* kodza-guard 3c82d02a3d53 — generated by Kodza, do not edit.
Theme guard: keeps a site's own CSS (WordPress themes, Bootstrap, CSS resets…) off this
component. :not(#_) is always true and weighs as much as an id, so these lines win over
theme rules made of classes and tags. Customise the component through its --kz-* variables. */
/* What the browser gives, where the component sets it only in some states: at the lowest weight, so its own rules below put it back */
:where(.kodza-wizard__dot):not(#_),
:where(.kodza-wizard__choice):not(#_),
:where(.kodza-wizard__back):not(#_),
:where(.kodza-wizard__next):not(#_) {
outline: revert;
outline-offset: revert;
}
:where(.kodza-wizard__title):not(#_) {
outline: revert;
}
/* What the browser gives, on everything the component leaves to it */
.kodza-wizard:not(#_) {
border: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
position: revert;
outline-offset: revert;
appearance: revert;
max-height: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__steps:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
box-sizing: revert;
float: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__step:not(#_) {
border: revert;
margin: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__dot:not(#_) {
margin: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
appearance: revert;
max-width: revert;
max-height: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
min-height: revert;
}
.kodza-wizard__num:not(#_),
.kodza-wizard__step-label:not(#_),
.kodza-wizard__panels:not(#_),
.kodza-wizard__choices:not(#_),
.kodza-wizard__hint:not(#_),
.kodza-wizard__error:not(#_),
.kodza-wizard__field:not(#_),
.kodza-wizard__label:not(#_),
.kodza-wizard__actions:not(#_),
.kodza-wizard__roll:not(#_),
.kodza-wizard__choice span:where(:not([class*="kodza-"])):not(#_),
.kodza-wizard__roll span:where(:not([class*="kodza-"])):not(#_) {
box-sizing: revert;
}
.kodza-wizard__check:not(#_) {
border: revert;
margin: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__panel:not(#_) {
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__title:not(#_) {
border: revert;
border-radius: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-style: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__group:not(#_) {
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__legend:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-style: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
white-space: revert;
}
.kodza-wizard__choice:not(#_) {
border: revert;
margin: revert;
text-decoration: revert;
list-style: revert;
float: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-style: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__radio:not(#_) {
border: revert;
padding: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
white-space: revert;
min-height: revert;
}
.kodza-wizard__note:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-style: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__box:not(#_) {
border: revert;
margin: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
float: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__input:not(#_) {
margin: revert;
border-radius: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
float: revert;
position: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
white-space: revert;
min-height: revert;
}
.kodza-wizard__summary:not(#_) {
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
border-right-width: revert;
border-bottom-width: revert;
border-left-width: revert;
border-right-style: revert;
border-bottom-style: revert;
border-left-style: revert;
border-right-color: revert;
border-bottom-color: revert;
border-left-color: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__text:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-family: revert;
font-weight: revert;
font-style: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__back:not(#_) {
margin: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
appearance: revert;
max-width: revert;
max-height: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
min-height: revert;
}
.kodza-wizard__status:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-style: revert;
text-underline-offset: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-wizard__next:not(#_) {
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
margin-top: revert;
margin-right: revert;
margin-bottom: revert;
box-shadow: revert;
appearance: revert;
max-width: revert;
max-height: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
min-height: revert;
}
.kodza-wizard__check:not(#_):where(:not([hidden])),
.kodza-wizard__title:not(#_):where(:not([hidden])),
.kodza-wizard__legend:not(#_):where(:not([hidden])),
.kodza-wizard__radio:not(#_):where(:not([hidden])),
.kodza-wizard__input:not(#_):where(:not([hidden])),
.kodza-wizard__text:not(#_):where(:not([hidden])),
.kodza-wizard__status:not(#_):where(:not([hidden])),
.kodza-wizard__next:not(#_):where(:not([hidden])) {
display: revert;
}
.kodza-wizard__check:not(#_):where([hidden]),
.kodza-wizard__title:not(#_):where([hidden]),
.kodza-wizard__legend:not(#_):where([hidden]),
.kodza-wizard__radio:not(#_):where([hidden]),
.kodza-wizard__input:not(#_):where([hidden]),
.kodza-wizard__text:not(#_):where([hidden]),
.kodza-wizard__status:not(#_):where([hidden]),
.kodza-wizard__next:not(#_):where([hidden]) {
display: none;
}
.kodza-wizard__steps:not(#_)::before,
.kodza-wizard__steps:not(#_)::after,
.kodza-wizard__error:not(#_)::before {
box-sizing: revert;
}
/* The component's own rules, one step stronger: real buttons and fields, what it sets on tags themes style (links, lists, headings, images…), and the root width (a theme may narrow it, never widen it) */
.kodza-wizard:not(#_) {
display: grid;
padding: 28px;
border-radius: calc(16px * var(--kz-radius-scale, 1));
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1px var(--kz-wizard-border);
color: var(--kz-wizard-fg);
box-sizing: border-box;
}
.kodza-wizard:not(#_) {
width: min(100%, var(--kz-wizard-width));
}
.kodza-wizard__steps:not(#_) {
position: relative;
display: none;
margin: 0;
padding: 0;
list-style: none;
}
.kodza-wizard.is-ready .kodza-wizard__steps:not(#_) {
display: grid;
}
.kodza-wizard__step:not(#_) {
position: relative;
display: grid;
}
.kodza-wizard__dot:not(#_) {
position: relative;
display: grid;
place-items: center;
width: var(--kz-wizard-dot);
height: var(--kz-wizard-dot);
padding: 0;
border: 0;
border-radius: 50%;
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-line);
color: var(--kz-wizard-muted);
font: inherit;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, revert);
white-space: nowrap;
transition: background-color calc(0.35s * var(--kz-motion-scale, 1)) ease,
box-shadow calc(0.35s * var(--kz-motion-scale, 1)) ease,
color calc(0.35s * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__dot:disabled:not(#_) {
cursor: default;
}
.kodza-wizard__dot:not(:disabled):not(#_) {
cursor: pointer;
}
.kodza-wizard__dot:focus-visible:not(#_) {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 3px;
}
.kodza-wizard__step.is-current .kodza-wizard__dot:not(#_),
.kodza-wizard__step.is-done .kodza-wizard__dot:not(#_) {
background: var(--kz-wizard-ink);
box-shadow: none;
color: var(--kz-wizard-on-ink);
}
.kodza-wizard__check:not(#_) {
transition: stroke-dashoffset calc(0.4s * var(--kz-motion-scale, 1)) var(--kz-wizard-ease);
}
.kodza-wizard__step.is-done .kodza-wizard__check:not(#_) {
transition-delay: calc(0.15s * var(--kz-motion-scale, 1));
}
.kodza-wizard__panel:where(fieldset):not(#_) {
display: grid;
margin: 0;
padding: 0;
border: 0;
}
.kodza-wizard__panel[hidden]:where(fieldset):not(#_),
.kodza-wizard.is-ready .kodza-wizard__panel:not(.is-current, .is-leaving):where(fieldset):not(#_) {
display: none;
}
.kodza-wizard.is-ready .kodza-wizard__panel.is-leaving:where(fieldset):not(#_) {
position: absolute;
}
.kodza-wizard__title:not(#_) {
float: left;
margin: 0;
padding: 0;
font-family: var(--kz-font-display, inherit);
font-size: calc(22px * var(--kz-font-display-scale, 1));
font-weight: var(--kz-font-display-weight, 600);
line-height: 1.2;
letter-spacing: var(--kz-font-display-tracking, -0.02em);
text-transform: var(--kz-font-display-case, inherit);
text-wrap: balance;
}
.kodza-wizard__title:focus:not(#_) {
outline: none;
}
.kodza-wizard__text:not(#_) {
margin: 0;
color: var(--kz-wizard-muted);
font-size: 15px;
line-height: 1.55;
}
.kodza-wizard__group:not(#_) {
display: grid;
margin: 0;
padding: 0;
border: 0;
}
.kodza-wizard__legend:not(#_) {
float: left;
margin: 0;
padding: 0;
color: var(--kz-wizard-muted);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__choice:not(#_) {
position: relative;
display: inline-flex;
padding: 0 18px;
border-radius: var(--kz-radius-pill, 999px);
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1px var(--kz-wizard-line);
color: var(--kz-wizard-fg);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 15px);
font-weight: var(--kz-font-label-weight, 500);
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
box-sizing: border-box;
transition: background-color calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease,
box-shadow calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease,
color calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__radio:not(#_) {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
margin: 0;
border-radius: inherit;
opacity: 0;
cursor: pointer;
}
@media (hover: hover) {
.kodza-wizard__choice:hover:not(#_) {
box-shadow: inset 0 0 0 1px var(--kz-wizard-line-hover);
}
}
.kodza-wizard__choice:has(.kodza-wizard__radio:checked):not(#_) {
background: var(--kz-wizard-ink);
box-shadow: inset 0 0 0 1px var(--kz-wizard-ink);
color: var(--kz-wizard-on-ink);
}
.kodza-wizard__choice:has(.kodza-wizard__radio:focus-visible):not(#_) {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 2px;
}
.kodza-wizard__group:has(.kodza-wizard__radio[aria-invalid="true"]) .kodza-wizard__choice:not(#_) {
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-error);
}
.kodza-wizard__box:not(#_) {
position: relative;
display: flex;
padding: 0 16px 9px;
border-radius: var(--kz-wizard-field-radius);
background: var(--kz-wizard-bg);
box-shadow: inset 0 0 0 1px var(--kz-wizard-line);
box-sizing: border-box;
transition: box-shadow calc(var(--kz-wizard-duration) * 0.42 * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__box:hover:not(#_) {
box-shadow: inset 0 0 0 1px var(--kz-wizard-line-hover);
}
.kodza-wizard__box:focus-within:not(#_) {
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-ink), 0 0 0 4px var(--kz-wizard-soft);
}
.kodza-wizard__input:not(#_) {
flex: 1;
min-width: 0;
height: 22px;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
font-size: 15px;
line-height: 22px;
outline: none;
box-sizing: border-box;
}
.kodza-wizard__field:has(.kodza-wizard__input[aria-invalid="true"]) .kodza-wizard__box:not(#_) {
box-shadow: inset 0 0 0 1.5px var(--kz-wizard-error);
}
.kodza-wizard__note:not(#_) {
display: grid;
margin: 0;
padding: 0 2px;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, inherit);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__summary:not(#_) {
display: grid;
margin: 0;
border-top: 1px solid var(--kz-wizard-border);
}
.kodza-wizard__status:not(#_) {
margin: 0;
color: var(--kz-wizard-error);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
line-height: var(--kz-font-label-leading, 1.4);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-align: center;
text-transform: var(--kz-font-label-case, inherit);
}
.kodza-wizard__back:not(#_),
.kodza-wizard__next:not(#_) {
flex: none;
height: 40px;
padding: 0 20px;
border: 0;
border-radius: var(--kz-radius-pill, 999px);
font: inherit;
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 15px);
font-weight: var(--kz-font-label-weight, 500);
line-height: 1;
letter-spacing: var(--kz-font-label-tracking, revert);
text-transform: var(--kz-font-label-case, revert);
white-space: nowrap;
cursor: pointer;
transition: opacity calc(0.25s * var(--kz-motion-scale, 1)) ease,
box-shadow calc(0.25s * var(--kz-motion-scale, 1)) ease;
}
.kodza-wizard__back:not(#_) {
display: none;
background: none;
box-shadow: inset 0 0 0 1px var(--kz-wizard-border);
color: var(--kz-wizard-fg);
}
.kodza-wizard.is-ready .kodza-wizard__back:not(#_) {
display: block;
}
.kodza-wizard__back:hover:not(#_) {
box-shadow: inset 0 0 0 1px var(--kz-wizard-muted);
}
.kodza-wizard__back:disabled:not(#_) {
opacity: 0;
pointer-events: none;
}
.kodza-wizard__next:not(#_) {
margin-left: auto;
background: var(--kz-wizard-ink);
color: var(--kz-wizard-on-ink);
}
.kodza-wizard__next[aria-busy="true"]:not(#_) {
cursor: progress;
}
.kodza-wizard__back:focus-visible:not(#_),
.kodza-wizard__next:focus-visible:not(#_) {
outline: 2px solid var(--kz-wizard-fg);
outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
.kodza-wizard__dot:not(#_) {
transition-duration: 0.01ms !important;
transition-delay: 0s !important;
}
}
@media (prefers-reduced-motion: reduce) {
.kodza-wizard__check:not(#_),
.kodza-wizard__choice:not(#_),
.kodza-wizard__box:not(#_) {
transition-duration: 0.01ms !important;
transition-delay: 0s !important;
}
}
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Form Wizard
// One real form, cut into steps. Next is the form's own submit button (Enter in a field does it
// too) and checks the step first: every faulty answer gets its error and the focus goes to the
// first one. Then the line fills, the old step leaves on the side you come from while the new one
// comes in from the other, and the card's height eases from one to the other. Back keeps every
// answer; a step already reached on the line jumps to it. The last step reads the answers back,
// each with its Edit: once the review is reached, Next on any step returns straight there, and the
// answer you changed rolls in.
// On the review, Next fires "kodza:submit" (cancelable, detail { data: FormData }): cancel it to
// send the answers yourself, and the done panel shows. Otherwise data-send="fetch" on the form
// posts them to its action without leaving the page (the label rolls to data-sending), and without
// it the form is sent the usual way. Fires "kodza:step" with { step } (0-based; the number of
// steps means sent).
// Settings: the --kz-wizard-* variables in the CSS, the words in data-* on the form (data-next,
// data-to-review, data-sending, data-edit, data-failed) and the distances below.
(() => {
const SELECTOR = '.kodza-wizard';
const LEAVE = 20; // px the old step slides as it leaves
const ENTER = 28; // px the new step slides in from
const FAILED = 'That did not go through. Try again.'; // a failed fetch, unless data-failed says otherwise
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
// The site's pace, --kz-motion-scale (set on :root, read on the instance): every duration of the
// script times it, and 0 moves nothing, like reduced motion
const paceOf = (el) => {
const pace = parseFloat(getComputedStyle(el).getPropertyValue('--kz-motion-scale'));
return pace >= 0 ? pace : 1;
};
let uid = 0;
// One instance. Everything it starts is tied to `signal`, so kodza:destroy stops it all
function mount(root, signal) {
const box = root.querySelector('.kodza-wizard__panels');
const next = root.querySelector('.kodza-wizard__next');
if (root.tagName !== 'FORM' || !box || !next) return;
const pace = paceOf(root);
const still = reduceMotion || !pace; // the still path: no motion asked, by the visitor or the site
const style = getComputedStyle(root);
const duration = (parseFloat(style.getPropertyValue('--kz-wizard-duration')) * 1000 || 600) * pace;
const ease = style.getPropertyValue('--kz-wizard-ease').trim() || 'ease';
const steps = [...root.querySelectorAll('.kodza-wizard__step')];
const review = box.querySelector(':scope > .kodza-wizard__review');
const done = box.querySelector(':scope > .kodza-wizard__done');
const panels = [...box.querySelectorAll(':scope > .kodza-wizard__panel')].filter((panel) => panel !== review && panel !== done);
if (!panels.length) return;
const pages = review ? [...panels, review] : panels; // what the line walks through
const last = pages.length - 1;
const summary = review?.querySelector('.kodza-wizard__summary');
const back = root.querySelector('.kodza-wizard__back');
const status = root.querySelector('.kodza-wizard__status');
const actions = root.querySelector('.kodza-wizard__actions');
const labels = {
next: root.dataset.next || 'Next',
back: root.dataset.toReview || 'Back to review',
send: next.textContent.trim() || 'Send',
sending: root.dataset.sending || 'Sending…',
};
root.noValidate = true; // each step is checked here, and says why in the form's own words
root.style.setProperty('--kz-wizard-n', steps.length);
const titleOf = (panel) => panel?.querySelector('.kodza-wizard__title');
[review, done].forEach((panel) => titleOf(panel)?.setAttribute('tabindex', '-1'));
// Mouse or keyboard: the focus only moves for the keyboard (or to an error)
let byKeyboard = false;
root.addEventListener('keydown', () => { byKeyboard = true; }, { signal });
root.addEventListener('pointerdown', () => { byKeyboard = false; }, { signal });
// A word that changes rolls: the old one goes up, the new one comes from below
const roll = (holder, text, delay = 0) => {
const prev = holder.lastElementChild;
if (prev?.textContent === text) return;
const span = document.createElement('span');
span.textContent = text;
holder.append(span);
if (!prev) return;
if (still) return prev.remove();
prev.setAttribute('aria-hidden', 'true');
const timing = { duration: duration * 0.8, delay, easing: ease };
prev.animate([{ transform: 'none' }, { transform: 'translateY(-110%)' }], { ...timing, fill: 'forwards' }).finished.then(() => prev.remove(), () => {});
span.animate([{ transform: 'translateY(110%)' }, { transform: 'none' }], { ...timing, fill: 'backwards' });
};
// The button label sits in a little window, and the button is as wide as its longest label
const word = document.createElement('span');
const window_ = document.createElement('span');
window_.className = 'kodza-wizard__roll';
window_.append(word);
next.replaceChildren(window_);
next.style.minWidth = `${Math.max(...Object.values(labels).map((text) => {
word.textContent = text;
return next.offsetWidth;
}))}px`;
word.textContent = labels.next;
// Every answer (a field, or a group of radios) with its note: the hint and the error are wired
// to it, in the order of the steps
const prefix = `kodza-wizard-${++uid}`;
const fields = [];
panels.forEach((panel, page) => {
panel.querySelectorAll('.kodza-wizard__field, .kodza-wizard__group').forEach((wrap) => {
const inputs = [...wrap.querySelectorAll('input, select, textarea')];
if (!inputs.length) return;
const note = wrap.querySelector(':scope > .kodza-wizard__note');
const hint = note?.querySelector('.kodza-wizard__hint');
const error = note?.querySelector('.kodza-wizard__error');
const id = `${prefix}-${fields.length}`;
const described = [];
if (hint) described.push((hint.id = `${id}-hint`));
if (error) described.push((error.id = `${id}-error`));
if (described.length) inputs.forEach((input) => input.setAttribute('aria-describedby', described.join(' ')));
const name = wrap.querySelector('.kodza-wizard__legend, .kodza-wizard__label')?.textContent.trim() || inputs[0].name;
fields.push({ inputs, note, error, page, name });
});
});
const pick = (input) => input.type === 'radio' || input.type === 'checkbox';
const firstOf = (field) => field.inputs.find((input) => input.checked) || field.inputs[0];
const check = (field) => {
const bad = field.inputs.find((input) => !input.validity.valid);
if (field.error) field.error.textContent = bad ? bad.dataset.error || field.inputs.find((input) => input.dataset.error)?.dataset.error || bad.validationMessage : '';
field.note?.classList.toggle('is-invalid', !!bad);
field.inputs.forEach((input) => input.setAttribute('aria-invalid', String(!!bad)));
return !bad;
};
// Every answer of the step, so that all its errors show at once
const checkPage = (page) => fields.filter((field) => field.page === page).map(check).every(Boolean);
const focusError = (page) => {
const field = fields.find((item) => item.page === page && item.inputs[0].getAttribute('aria-invalid') === 'true');
field?.inputs[0].focus();
};
// Judged on Next, then live while the visitor fixes it. A field left with a typed value is
// judged right away (an email with no @); an empty one waits for Next
fields.forEach((field) => field.inputs.forEach((input) => {
input.addEventListener(pick(input) ? 'change' : 'input', () => {
if (status) status.textContent = '';
if (input.getAttribute('aria-invalid') === 'true') check(field);
}, { signal });
if (!pick(input)) input.addEventListener('blur', () => input.value && check(field), { signal });
}));
// The review: one line per answer given, in the order of the steps
const rows = new Map();
let editing = null; // the answer whose Edit was pressed, to come back to on the review
const answer = (field) => field.inputs
.filter((input) => (pick(input) ? input.checked : input.value.trim()))
.map((input) => (pick(input) ? input.closest('label')?.textContent.trim() || input.value : input.value.trim()))
.join(', ');
const fill = (delay) => {
if (!summary) return;
let index = 0;
fields.forEach((field) => {
const value = answer(field);
let row = rows.get(field);
if (!value) {
row?.el.remove();
rows.delete(field);
return;
}
if (!row) {
const el = document.createElement('div');
el.className = 'kodza-wizard__row';
const term = document.createElement('dt');
term.textContent = field.name;
const desc = document.createElement('dd');
const holder = document.createElement('span');
holder.className = 'kodza-wizard__value';
const edit = document.createElement('button');
edit.type = 'button';
edit.className = 'kodza-wizard__edit';
edit.textContent = root.dataset.edit || 'Edit';
edit.setAttribute('aria-label', `${edit.textContent} ${field.name.toLowerCase()}`);
edit.addEventListener('click', () => {
editing = field;
go(field.page);
if (byKeyboard) firstOf(field).focus({ preventScroll: true });
}, { signal });
desc.append(holder, edit);
el.append(term, desc);
row = { el, holder, edit };
rows.set(field, row);
}
roll(row.holder, value, delay);
if (summary.children[index] !== row.el) summary.insertBefore(row.el, summary.children[index] || null);
index += 1;
});
};
// The step change: the old step leaves (placed over the new one) while the new one comes in
// from the side you head to, and the panels' height eases between the two. On sending, the buttons fade
// and the card closes over them
let moving = [];
const swap = (from, to, forward, sent) => {
const h0 = box.offsetHeight; // where a change still running stands
const H0 = root.offsetHeight;
moving.forEach((animation) => animation.cancel());
moving = [];
box.querySelectorAll(':scope > .is-leaving').forEach((panel) => panel.classList.remove('is-leaving'));
from?.classList.remove('is-current');
to.classList.add('is-current');
root.classList.toggle('is-sent', sent);
if (!from || still) return;
from.classList.add('is-leaving');
const h1 = box.offsetHeight;
const H1 = root.offsetHeight;
if (sent) root.classList.remove('is-sent');
const side = forward ? -1 : 1;
const run = (el, frames, timing) => moving.push(el.animate(frames, timing)) && moving[moving.length - 1];
run(from, [{ opacity: 1 }, { opacity: 0 }], { duration: 220 * pace, easing: 'ease', fill: 'forwards' });
run(from, [{ transform: 'none' }, { transform: `translateX(${side * LEAVE}px)` }], { duration: 320 * pace, easing: 'ease-in', fill: 'forwards' });
run(to, [{ opacity: 0 }, { opacity: 1 }], { duration: 400 * pace, delay: 40 * pace, easing: 'ease', fill: 'backwards' });
run(to, [{ transform: `translateX(${side * -ENTER}px)` }, { transform: 'none' }], { duration, easing: ease });
box.style.clipPath = 'inset(-8px -28px 0)'; // what is past the moving edge stays hidden
const height = run(box, [{ height: `${h0}px` }, { height: `${h1}px` }], { duration, easing: ease });
if (sent && actions) {
root.style.overflow = 'hidden';
run(actions, [{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'translateY(8px)' }], { duration: 220 * pace, easing: 'ease', fill: 'forwards' });
run(root, [{ height: `${H0}px` }, { height: `${H1}px` }], { duration, easing: ease });
}
height.finished.then(() => {
from.classList.remove('is-leaving');
box.style.removeProperty('clip-path');
root.style.removeProperty('overflow');
if (sent) root.classList.add('is-sent');
moving.forEach((animation) => animation.cancel());
moving = [];
}, () => {});
};
let current = -1;
let reached = 0; // the furthest step shown: every step up to it can be jumped to
const go = (target, focus = false) => {
if (target === current) return;
const sent = target > last;
const from = current < 0 ? null : current > last ? done : pages[current];
const to = sent ? done : pages[target];
if (!to) return;
const forward = target > current;
const hadBack = document.activeElement === back;
reached = Math.max(reached, Math.min(target, last));
if (to === review) fill(from && !still ? duration * 0.5 : 0);
steps.forEach((step, i) => {
const finished = sent || (i < reached && i !== target);
step.classList.toggle('is-done', finished);
step.classList.toggle('is-current', i === target);
const dot = step.querySelector('.kodza-wizard__dot');
const label = step.querySelector('.kodza-wizard__step-label')?.textContent.trim() || `Step ${i + 1}`;
if (!dot) return;
dot.disabled = sent || i === target || i > reached;
dot.setAttribute('aria-label', `${label}, step ${i + 1} of ${steps.length}${finished ? ', done' : i === target ? ', current' : ''}`);
if (i === target) step.setAttribute('aria-current', 'step');
else step.removeAttribute('aria-current');
});
root.style.setProperty('--kz-wizard-progress', sent || !last ? 1 : reached / last);
if (back) back.disabled = target === 0 || sent;
if (status) status.textContent = '';
roll(window_, target >= last ? labels.send : reached === last ? labels.back : labels.next);
swap(from, to, forward, sent);
current = target;
root.dispatchEvent(new CustomEvent('kodza:step', { detail: { step: target }, bubbles: true }));
// The button that had the focus is gone: the focus goes to the news. Otherwise it only moves
// for the keyboard: to the step's first answer, or back to the Edit you left from
if (sent) return titleOf(done)?.focus({ preventScroll: true });
if (focus) {
const field = fields.find((item) => item.page === target);
const back_ = to === review && editing && rows.get(editing)?.edit;
(back_ || (field ? firstOf(field) : titleOf(to)))?.focus({ preventScroll: true });
} else if (hadBack && back.disabled) next.focus({ preventScroll: true });
if (to === review) editing = null;
};
// Moving on checks every step on the way: the first faulty one stops it there
const reach = (target) => {
for (let page = current; page < target; page += 1) {
if (page < panels.length && !checkPage(page)) {
go(page);
return focusError(page);
}
}
go(target, byKeyboard);
};
let sending = false;
const send = async (data) => {
sending = true;
next.setAttribute('aria-busy', 'true');
roll(window_, labels.sending);
const method = (root.getAttribute('method') || 'get').toUpperCase();
const url = method === 'GET' ? `${root.action}${root.action.includes('?') ? '&' : '?'}${new URLSearchParams(data)}` : root.action;
try {
const response = await fetch(url, { method, body: method === 'GET' ? undefined : data, headers: { Accept: 'application/json' }, signal });
if (!response.ok) throw new Error(String(response.status));
sending = false;
go(last + 1);
} catch (error) {
if (signal.aborted) return;
sending = false;
if (status) status.textContent = root.dataset.failed || FAILED;
roll(window_, labels.send);
}
next.removeAttribute('aria-busy');
};
root.addEventListener('submit', (event) => {
if (sending || current > last) return event.preventDefault();
if (current < last) {
event.preventDefault();
return reach(reached === last ? last : current + 1);
}
// The review (or the last step): every step once more, then the form goes
const faulty = panels.findIndex((_, page) => !checkPage(page));
if (faulty >= 0) {
event.preventDefault();
go(faulty);
return focusError(faulty);
}
const data = new FormData(root);
if (!root.dispatchEvent(new CustomEvent('kodza:submit', { detail: { data }, bubbles: true, cancelable: true }))) {
event.preventDefault();
return go(last + 1);
}
if (root.dataset.send !== 'fetch') return; // sent the usual way
event.preventDefault();
send(data);
}, { signal });
back?.addEventListener('click', () => go(current - 1, byKeyboard), { signal });
steps.forEach((step, i) => step.querySelector('.kodza-wizard__dot')?.addEventListener('click', () => (i < current ? go(i, byKeyboard) : reach(i)), { signal }));
// From here, the steps are shown by the script, one at a time, not by the hidden attribute
[review, done].forEach((panel) => panel?.removeAttribute('hidden'));
root.classList.add('is-ready');
go(0);
}
// Kodza lifecycle, the same in every component: `kodza:init` starts the instances inside
// event.detail.root (the whole page by default), `kodza:destroy` stops them and puts their
// markup back. For themes and apps that swap content without a page load. Each running root
// keeps its markup as written under KODZA, shared by every Kodza script on the page: a Kodza
// component inside another one is saved as written, not half-started, and stopped with it. Two
// components on one root (a reveal on a stat card) both start, and stop together.
const KODZA = Symbol.for('kodza');
const RUNNING = Symbol.for(`kodza ${SELECTOR}`); // a root this component runs on, for every copy of this script
const instances = new WeakMap();
const find = (scope = document) => [scope, ...scope.querySelectorAll(SELECTOR)].filter((el) => el.matches?.(SELECTOR));
const attrsOf = (el) => [...el.attributes].map((a) => [a.name, a.value]);
const put = (el, saved) => {
[...el.attributes].forEach((a) => el.removeAttribute(a.name));
saved.attrs.forEach(([name, value]) => el.setAttribute(name, value));
el.innerHTML = saved.html;
};
// The markup inside a root as written: Kodza components already running in it give back their own
const written = (root) => {
const all = [...root.querySelectorAll('*')];
if (!all.some((el) => el[KODZA])) return root.innerHTML;
const copy = root.cloneNode(true);
const twins = copy.querySelectorAll('*');
let last = null;
all.forEach((el, i) => {
if (!el[KODZA] || last?.contains(el)) return;
last = el;
put(twins[i], el[KODZA]);
});
return copy.innerHTML;
};
const init = (scope) => find(scope).forEach((root) => {
// Already running, maybe from another copy of this script. Marked is-ready with no Kodza component
// running on it, a root is a copy of a started one (a cloned slide): it is left as it is
if (root[RUNNING] || (root.classList.contains('is-ready') && !root[KODZA])) return;
// Rendered by React (data-kodza-manual): React starts it, with an init aimed at that markup once
// it has hydrated it. Any earlier start would change markup React has not taken over yet
const owner = root.closest('[data-kodza-manual]');
if (owner && !(scope && owner.contains(scope))) return;
const controller = new AbortController();
// Another Kodza component already running on this root: its markup as written is kept, and the
// two stop together
const before = root[KODZA];
const saved = { html: before ? before.html : written(root), attrs: before ? before.attrs : attrsOf(root), stop: () => destroy(root) };
if (before) before.above = saved;
instances.set(root, { controller, saved, before });
root[KODZA] = saved;
root[RUNNING] = true;
mount(root, controller.signal);
root.classList.add('is-ready');
});
const destroy = (scope) => find(scope).forEach((root) => {
const instance = instances.get(root);
if (!instance) return;
instances.delete(root);
instance.saved.above?.stop(); // a Kodza component started after it on the same root stops first
// The Kodza components running inside it stop first: once its markup is put back, their own
// script could not find them any more
root.querySelectorAll('*').forEach((el) => el[KODZA]?.stop());
instance.controller.abort();
delete root[RUNNING];
// Started on top of another one: that one stops next, and puts the markup back
if (instance.before) {
delete instance.before.above;
root[KODZA] = instance.before;
return instance.before.stop();
}
delete root[KODZA];
put(root, instance.saved);
});
document.addEventListener('kodza:init', (event) => init(event.detail?.root));
document.addEventListener('kodza:destroy', (event) => destroy(event.detail?.root));
init();
// Loaded in <head>, the script runs before the markup exists: once more when it is parsed
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => init(), { once: true });
})();
'use client';
// Kodza — Form Wizard, for React. From https://kodza.dev/components/form-wizard/
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Next to this file: form-wizard.css and form-wizard.js, the component's CSS and JS from Kodza, as they are.
// Yours to edit: the markup is plain JSX below.
// The script changes this markup once React has rendered it (it adds layers, splits text, moves
// nodes), so React must not patch it afterwards. When a prop changes, the key gives React a fresh
// element: kodza:destroy stops the script on the old one, kodza:init starts it on the new one.
// data-kodza-manual keeps the script from starting it on its own: the effect below does, once
// React has hydrated the markup (on a page that streams in, the script can load first).
// Built from your data (tabs, rows, options)? Put what the markup is made of in the key, as plain
// values (ids, text, numbers): a change starts the script again on fresh markup. What the visitor
// changes (the open tab, the sort, what they type) is the script's: keep it out of the key, follow
// it with onClick or onInput on the root, and change it from your code as a visitor would (click
// the tab; set the field's value, then dispatch a bubbling input event).
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './form-wizard.css';
export type FormWizardProps = Omit<ComponentPropsWithoutRef<'form'>, "children" | "vars" | "next" | "toReview" | "sending" | "onStep" | "onSubmit"> & {
/** data-next on the root (default: Next) */
next?: "Next";
/** data-to-review on the root (default: Back to review) */
toReview?: "Back to review";
/** data-sending on the root (default: Sending…) */
sending?: "Sending…";
/** Settings, as CSS variables on the root */
vars?: {
/** default: #ffffff */
"--kz-wizard-bg"?: string | number;
/** default: #0a0a0a */
"--kz-wizard-fg"?: string | number;
/** default: rgba(10, 10, 10, 0.6) */
"--kz-wizard-muted"?: string | number;
/** default: rgba(10, 10, 10, 0.1) */
"--kz-wizard-border"?: string | number;
/** default: rgba(10, 10, 10, 0.14) */
"--kz-wizard-line"?: string | number;
/** default: rgba(10, 10, 10, 0.3) */
"--kz-wizard-line-hover"?: string | number;
/** default: rgba(10, 10, 10, 0.04) */
"--kz-wizard-soft"?: string | number;
/** default: #0a0a0a */
"--kz-wizard-ink"?: string | number;
/** default: #ffffff */
"--kz-wizard-on-ink"?: string | number;
/** a message, never colour alone: set a red here if you want one — default: #0a0a0a */
"--kz-wizard-error"?: string | number;
/** default: 560px */
"--kz-wizard-width"?: string | number;
/** default: 28px */
"--kz-wizard-dot"?: string | number;
/** default: 56px */
"--kz-wizard-field-height"?: string | number;
/** default: calc(12px * var(--kz-radius-scale, 1)) */
"--kz-wizard-field-radius"?: string | number;
/** a step change; the field states take 2/3 of it — default: 0.6s */
"--kz-wizard-duration"?: string | number;
/** default: cubic-bezier(0.22, 1, 0.36, 1) */
"--kz-wizard-ease"?: string | number;
};
/** "kodza:step", fired by the script (bubbles from the root) */
onStep?: (event: CustomEvent) => void;
/** "kodza:submit", fired by the script (bubbles from the root) */
onSubmit?: (event: CustomEvent) => void;
className?: string;
};
export function FormWizard({ next = "Next", toReview = "Back to review", sending = "Sending…", vars, onStep, onSubmit, className, style, ...rest }: FormWizardProps) {
const ref = useRef<ComponentRef<'form'>>(null);
const classes = ["kodza-wizard", className].filter(Boolean).join(' ');
// Everything the markup is made of: when it changes, React gets a fresh element (see the top)
const key = JSON.stringify([classes, next, toReview, sending, vars, style, rest]);
// Starts the script on this element once React has rendered it, stops it when it goes
useEffect(() => {
const root = ref.current;
let live = true;
// @ts-ignore: a plain script, no types to find
import('./form-wizard.js').then(() => {
if (live) document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root } }));
});
return () => {
live = false;
document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } }));
};
}, [key]);
useEffect(() => {
const root = ref.current;
if (!root || !onStep) return;
const listener = (event: Event) => onStep(event as CustomEvent);
root.addEventListener("kodza:step", listener);
return () => root.removeEventListener("kodza:step", listener);
}, [onStep, key]);
useEffect(() => {
const root = ref.current;
if (!root || !onSubmit) return;
const listener = (event: Event) => onSubmit(event as CustomEvent);
root.addEventListener("kodza:submit", listener);
return () => root.removeEventListener("kodza:submit", listener);
}, [onSubmit, key]);
return (
<form action="#" method="post" key={key} {...rest} className={classes} data-kodza-manual data-next={next} data-to-review={toReview} data-sending={sending} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
<ol className="kodza-wizard__steps">
<li className="kodza-wizard__step">
<button className="kodza-wizard__dot" type="button">
<span className="kodza-wizard__num">1</span>
<svg className="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true">
<path d="M3.5 8.5l3 3 6-7" pathLength="1" />
</svg>
</button>
<span className="kodza-wizard__step-label">Project</span>
</li>
<li className="kodza-wizard__step">
<button className="kodza-wizard__dot" type="button">
<span className="kodza-wizard__num">2</span>
<svg className="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true">
<path d="M3.5 8.5l3 3 6-7" pathLength="1" />
</svg>
</button>
<span className="kodza-wizard__step-label">Budget</span>
</li>
<li className="kodza-wizard__step">
<button className="kodza-wizard__dot" type="button">
<span className="kodza-wizard__num">3</span>
<svg className="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true">
<path d="M3.5 8.5l3 3 6-7" pathLength="1" />
</svg>
</button>
<span className="kodza-wizard__step-label">Contact</span>
</li>
<li className="kodza-wizard__step">
<button className="kodza-wizard__dot" type="button">
<span className="kodza-wizard__num">4</span>
<svg className="kodza-wizard__check" viewBox="0 0 16 16" aria-hidden="true">
<path d="M3.5 8.5l3 3 6-7" pathLength="1" />
</svg>
</button>
<span className="kodza-wizard__step-label">Review</span>
</li>
</ol>
<div className="kodza-wizard__panels">
<fieldset className="kodza-wizard__panel">
<legend className="kodza-wizard__title">What are we building?</legend>
<fieldset className="kodza-wizard__group">
<legend className="kodza-wizard__legend">Project</legend>
<div className="kodza-wizard__choices">
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="project" defaultValue="site" required data-error="Pick one. Any one." />
<span>Marketing site</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="project" defaultValue="shop" />
<span>Online shop</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="project" defaultValue="redesign" />
<span>Redesign</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="project" defaultValue="unsure" />
<span>No idea yet</span>
</label>
</div>
<p className="kodza-wizard__note">
<span className="kodza-wizard__hint">You can change your mind. We do it all the time.</span>
<span className="kodza-wizard__error" aria-live="polite" />
</p>
</fieldset>
<div className="kodza-wizard__field">
<label className="kodza-wizard__box">
<input className="kodza-wizard__input" type="url" name="current_site" placeholder=" " autoComplete="url" data-error="A full address, with https://." />
{' '}
<span className="kodza-wizard__label">Current site</span>
</label>
<p className="kodza-wizard__note">
<span className="kodza-wizard__hint">Optional. We will not judge it. Much.</span>
<span className="kodza-wizard__error" aria-live="polite" />
</p>
</div>
</fieldset>
<fieldset className="kodza-wizard__panel">
<legend className="kodza-wizard__title">What is the budget?</legend>
<fieldset className="kodza-wizard__group">
<legend className="kodza-wizard__legend">Budget</legend>
<div className="kodza-wizard__choices">
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="budget" defaultValue="under-5k" required data-error="A ballpark is fine. Nobody holds you to it." />
<span>Under €5k</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="budget" defaultValue="5-15k" />
<span>€5k to €15k</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="budget" defaultValue="over-15k" />
<span>Over €15k</span>
</label>
</div>
<p className="kodza-wizard__note">
<span className="kodza-wizard__hint">A ballpark. Nobody holds you to it.</span>
<span className="kodza-wizard__error" aria-live="polite" />
</p>
</fieldset>
<fieldset className="kodza-wizard__group">
<legend className="kodza-wizard__legend">Launch</legend>
<div className="kodza-wizard__choices">
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="launch" defaultValue="asap" required data-error="Pick one. No rush is an answer too." />
<span>Yesterday</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="launch" defaultValue="quarter" />
<span>This quarter</span>
</label>
{' '}
<label className="kodza-wizard__choice">
<input className="kodza-wizard__radio" type="radio" name="launch" defaultValue="later" />
<span>No rush</span>
</label>
</div>
<p className="kodza-wizard__note">
<span className="kodza-wizard__hint">Yesterday costs the same. It just ships later.</span>
<span className="kodza-wizard__error" aria-live="polite" />
</p>
</fieldset>
</fieldset>
<fieldset className="kodza-wizard__panel">
<legend className="kodza-wizard__title">Where do we send the quote?</legend>
<div className="kodza-wizard__field">
<label className="kodza-wizard__box">
<input className="kodza-wizard__input" type="text" name="name" placeholder=" " autoComplete="name" required data-error="We need something to call you." />
{' '}
<span className="kodza-wizard__label">Name</span>
</label>
<p className="kodza-wizard__note">
<span className="kodza-wizard__hint">A first name is plenty.</span>
<span className="kodza-wizard__error" aria-live="polite" />
</p>
</div>
<div className="kodza-wizard__field">
<label className="kodza-wizard__box">
<input className="kodza-wizard__input" type="email" name="email" placeholder=" " autoComplete="email" required data-error="That does not look like an email." />
{' '}
<span className="kodza-wizard__label">Email</span>
</label>
<p className="kodza-wizard__note">
<span className="kodza-wizard__hint">One email, with the quote. That is it.</span>
<span className="kodza-wizard__error" aria-live="polite" />
</p>
</div>
</fieldset>
<section className="kodza-wizard__panel kodza-wizard__review" hidden>
<h3 className="kodza-wizard__title">Check it. Then send it.</h3>
<dl className="kodza-wizard__summary" />
</section>
<section className="kodza-wizard__panel kodza-wizard__done" hidden>
<h3 className="kodza-wizard__title">Sent.</h3>
<p className="kodza-wizard__text">A human reads it today. The quote lands in your inbox within two days, in plain numbers.</p>
</section>
</div>
<div className="kodza-wizard__actions">
<button className="kodza-wizard__back" type="button">Back</button>
<p className="kodza-wizard__status" aria-live="polite" />
<button className="kodza-wizard__next" type="submit">Send request</button>
</div>
</form>
);
}
Checked
Robots poked at it before you did. Every component goes through the same checks, and again each time it changes.