Multi-step onboarding wizard
Three steps with a progress bar, each checked before the next one opens, so nobody reaches the end to find a mistake on step one. Try Next with the email empty.
{
"id": "customer-onboarding",
"version": "1.4.0",
"title": "Customer onboarding",
"description": "Tell us a little about you and your team so we can set up your workspace. Takes about 3 minutes.",
"fields": [
{
"id": "wizard-1",
"type": "wizard",
"props": {
"finishLabel": "Create my workspace"
},
"children": [
{
"id": "s1",
"type": "wizardStep",
"props": {
"label": "About you"
},
"children": [
{
"id": "f1",
"name": "fullName",
"type": "text",
"props": {
"label": "Full name",
"placeholder": "Jordan Rivera",
"required": true,
"columnSpan": 6
},
"validation": [
{
"type": "required",
"message": "This field is required"
},
{
"type": "minLength",
"value": 2,
"message": "Use at least 2 characters"
}
]
},
{
"id": "f2",
"name": "workEmail",
"type": "email",
"props": {
"label": "Work email",
"placeholder": "jordan@northwind.io",
"helperText": "We'll send your workspace invite here.",
"required": true,
"columnSpan": 6
},
"validation": [
{
"type": "required",
"message": "This field is required"
},
{
"type": "email",
"message": "Enter a valid email address"
}
]
},
{
"id": "f3",
"name": "phone",
"type": "phone",
"props": {
"label": "Phone",
"placeholder": "(555) 012-3456",
"columnSpan": 6
}
},
{
"id": "f4",
"name": "jobTitle",
"type": "text",
"props": {
"label": "Job title",
"placeholder": "Head of Operations",
"columnSpan": 6
}
},
{
"id": "f5",
"name": "role",
"type": "radio",
"props": {
"label": "What best describes your role?",
"layout": "cards",
"options": [
{
"value": "founderExec",
"label": "Founder / exec"
},
{
"value": "engineering",
"label": "Engineering"
},
{
"value": "productDesign",
"label": "Product & design"
},
{
"value": "operations",
"label": "Operations"
},
{
"value": "salesMarketing",
"label": "Sales & marketing"
},
{
"value": "somethingElse",
"label": "Something else"
}
],
"required": true
},
"validation": [
{
"type": "required",
"message": "This field is required"
}
]
}
]
},
{
"id": "s2",
"type": "wizardStep",
"props": {
"label": "Your company"
},
"children": [
{
"id": "f6",
"name": "company",
"type": "text",
"props": {
"label": "Company name",
"placeholder": "Northwind Labs",
"required": true,
"columnSpan": 6
},
"validation": [
{
"type": "required",
"message": "This field is required"
}
]
},
{
"id": "f7",
"name": "website",
"type": "url",
"props": {
"label": "Website",
"placeholder": "northwind.io",
"columnSpan": 6
},
"validation": [
{
"type": "url",
"message": "Enter a valid URL"
}
]
},
{
"id": "f8",
"name": "teamSize",
"type": "select",
"props": {
"label": "Team size",
"placeholder": "Select a range",
"options": [
{
"value": "1-10",
"label": "1–10"
},
{
"value": "11-50",
"label": "11–50"
},
{
"value": "51-200",
"label": "51–200"
},
{
"value": "201-1-000",
"label": "201–1,000"
},
{
"value": "1-000",
"label": "1,000+"
}
],
"required": true,
"columnSpan": 6
},
"validation": [
{
"type": "required",
"message": "This field is required"
}
]
},
{
"id": "f9",
"name": "industry",
"type": "select",
"props": {
"label": "Industry",
"placeholder": "Select an industry",
"options": [
{
"value": "saasSoftware",
"label": "SaaS & software"
},
{
"value": "financialServices",
"label": "Financial services"
},
{
"value": "healthcare",
"label": "Healthcare"
},
{
"value": "education",
"label": "Education"
},
{
"value": "retailECommerce",
"label": "Retail & e-commerce"
},
{
"value": "other",
"label": "Other"
}
],
"columnSpan": 6
}
},
{
"id": "f10",
"name": "securityNeeds",
"type": "textarea",
"props": {
"label": "Security & compliance requirements",
"placeholder": "SSO, SCIM provisioning, data residency, audit logs…",
"helperText": "Only shown to teams with 200+ people."
},
"conditions": [
{
"when": {
"field": "teamSize",
"operator": "equals",
"value": "201-1-000",
"or": [
{
"field": "teamSize",
"operator": "equals",
"value": "1-000"
}
]
},
"then": {
"action": "show"
},
"else": {
"action": "hide"
}
}
]
},
{
"id": "f11",
"name": "goals",
"type": "checkboxGroup",
"props": {
"label": "What do you want to automate first?",
"options": [
{
"value": "leadCapture",
"label": "Lead capture"
},
{
"value": "customerOnboarding",
"label": "Customer onboarding"
},
{
"value": "approvals",
"label": "Approvals"
},
{
"value": "supportIntake",
"label": "Support intake"
},
{
"value": "internalRequests",
"label": "Internal requests"
}
]
}
}
]
},
{
"id": "s3",
"type": "wizardStep",
"props": {
"label": "Preferences"
},
"children": [
{
"id": "f12",
"name": "startDate",
"type": "date",
"props": {
"label": "Preferred start date",
"columnSpan": 6
}
},
{
"id": "f13",
"name": "seats",
"type": "number",
"props": {
"label": "How many seats?",
"placeholder": "25",
"columnSpan": 6
},
"validation": [
{
"type": "min",
"value": 1,
"message": "At least 1 seat"
},
{
"type": "max",
"value": 500,
"message": "Contact sales for 500+"
}
]
},
{
"id": "f14",
"name": "currentTools",
"type": "rating",
"props": {
"label": "How happy are you with your current tools?"
}
},
{
"id": "f15",
"name": "brandAssets",
"type": "file",
"props": {
"label": "Brand assets",
"helperText": "Logo and colours so your forms look like you. PNG, SVG or PDF up to 10 MB."
}
},
{
"id": "f16",
"name": "productUpdates",
"type": "switch",
"props": {
"label": "Send me product updates",
"text": "One email a month. Unsubscribe anytime."
}
},
{
"id": "f17",
"name": "terms",
"type": "checkbox",
"props": {
"label": "Terms",
"text": "I agree to the Terms of Service and Privacy Policy",
"required": true
},
"validation": [
{
"type": "required",
"message": "This field is required"
}
]
}
]
}
]
}
]
}import { KraftForm } from '@kraftwizard/forms-core';
import { registerAllComponents } from '@kraftwizard/forms-components';
import '@kraftwizard/forms-components/styles.css';
import schema from './customer-onboarding.form.json';
registerAllComponents();
export function Onboarding() {
return (
<KraftForm
schema={schema}
onSubmit={(values) =>
fetch('/api/workspaces', { method: 'POST', body: JSON.stringify(values) })
}
/>
);
}The wizard field checks the current step before it moves on, and Finish submits the whole form. Set validateOnStep: false on it for steps that are optional. The step someone is on isn't part of the values.