Persona onboarding (Pro)
ProIncluded in $99Role and goal questions that tailor the first chat, with that chat drawn beside them and redrawn on every answer.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { PersonaOnboarding } from "@/components/ui/chatcn/pro/persona-onboarding"
<PersonaOnboarding
questions={[
{ id: "role", title: "What do you do?", options: [{ value: "design", label: "Design" }, …] },
{ id: "goals", title: "What will you use it for first?", multiple: true, options: […] },
]}
tailor={(answers) => ({
greeting: "Hi. Here is where designers usually start.",
starters: [{ title: "Critique this flow", reason: "For designers", from: "role" }],
defaults: [{ label: "Model", value: "Claude Sonnet 5.5", from: "goals" }],
})}
onDone={(answers, preview) => saveWorkspace(answers, preview)}
onSkip={useDefaults}
/>One question at a time, single or pick any, and every one can be skipped: Next reads Skip question until something is picked. tailor turns the answers into the first chat (a greeting, starters and defaults such as the model or answer style) and runs on every change, so the preview beside the question is always the real result. Only what an answer changed moves: starters that stay keep their place and new ones rise in. Tag a starter or default with from, the question that shaped it, and it is outlined while that question is on screen, so the reader sees what each answer is for before giving it. Wide frames put the preview beside the questions; narrow ones put it underneath.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
questions | PersonaQuestion[] | { id, title, hint?, options, multiple? } |
tailor | (answers) => PersonaPreview | { greeting, starters, defaults? }; keep it pure |
value, defaultValue, onValueChange | Record<string, string[]> | The answers |
step, defaultStep, onStepChange | number | The question on screen |
onDone | (answers, preview) => void | Start chatting, on the last question |
onSkip | () => void | Shows Skip setup |
labels | Partial<PersonaOnboardingLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves between the choices and the buttons |
| Arrow keys | Move between choices |
| Enter, Space | Pick a choice |
Accessibility
- Choices are toggle buttons in a group named by the question, and report whether they are pressed.
- Stepping moves focus to the new question's heading.
- The preview is a labelled region and its greeting is announced politely when it changes.
Motion
A new question slides in 12 px from the side it came from over 220 ms. New starters and defaults rise 4 px over 240 ms; unchanged ones stay still. Nothing moves on first paint or under reduced motion.