问卷

智能体在承诺计划之前提出的问题,作为聊天线程中的卡片。每一步一个问题:顶部有提示,答案为带有复选框或数字键的带边框行,可选的自由文本其他行,以及每一步在“上一步”和“下一步”旁边带有胶囊的页脚。问题沿着行进方向滑动,同时卡片以动画方式移动到下一个问题的高度。

Which harness controls should stay in the top bar?

Other

安装

调查问卷是 BoardUI Pro 的一部分。

已支持深色模式,此 组件 会自动使用 BoardUI 的语义设计变量。 设置主题切换.

专业版访问

问卷 是专业人士 组件.

您的 BoardUI Pro 许可证可以解锁此功能 组件 及其所有源文件。激活您的许可证一次,然后使用 CLI 将其直接安装到您的项目中。

01

激活您的许可证

使用 Lemon Squeezy 购买电子邮件中的密钥。每台机器只需执行一次此操作。

npx boardui@latest login YOUR_LICENSE_KEY
02

安装 组件

CLI 会复制源代码并为您解决每个 BoardUI 和 npm 依赖项。

npx boardui@latest add questionnaire

这个 组件 包含在 BoardUI Pro 中

立即获取 BoardUI Pro 并立即安装。

使用共享 UI 包或自定义导入别名? 配置您的安装路径 在运行 CLI 之前。复制粘贴示例使用默认导入。

多选

默认模式。每一行都是一张复选框卡:按其上的任意位置即可勾选它,并且可以根据需要勾选多个。 下一步 转到下一个问题, 上一步 返回时,蜱虫完好无损,步骤胶囊会直接跳到任何问题。最后一个问题的按钮显示 完成 和火灾 onComplete 每一个答案。

Which harness controls should stay in the top bar?

Other
{/* The default: every row is a checkbox and Next moves on */}<Questionnaire select="multiple" questions={[ { id: "controls", question: "Which harness controls should stay in the top bar?", options: [ { value: "upsell", label: "Show up sell toggle", description: "Forces the upsell card up." }, { value: "wallpaper", label: "Wallpaper picker", description: "The chat wallpaper choices." }, ], other: true, // adds the free-text row; typing ticks it stepLabel: "Top bar", // pill label, "Step 1" otherwise }, ]} onComplete={(answers) => { // answers.controls → { values: ["upsell", "wallpaper"], other: "Model picker" } }}/>

单选

套装 选择 到 single 在卡片上或问题上。复选框变成数字键,通过单击或其数字选择一行,之后会自行移动 advanceDelay 所以选择的是看到登陆。返回显示突出显示的选择。另一行则等待文本:按 Enter 发送文本。

How should the permission pill behave while an agent is running?

Other
{/* Single select numbers the rows; a pick moves on after 180ms */}<Questionnaire select="single" advanceDelay={180} questions={[ { id: "permission", question: "How should the permission pill behave while an agent is running?", options: [ { value: "lock", label: "Lock it", description: "Changes wait until the run finishes." }, { value: "queue", label: "Queue the change", description: "Applies from the next turn." }, { value: "apply", label: "Apply immediately", description: "Interrupts the current tool call." }, ], other: { placeholder: "Describe the behaviour" }, }, ]} onComplete={(answers) => { // answers.permission → { values: ["queue"] } or { values: [], other: "..." } }}/> {/* Mix modes per question: the card-level select is only the default */}<Questionnaire questions={[{ id: "a", select: "multiple", /* … */ }, { id: "b", select: "single", /* … */ }]} />

答案和步骤

答案由问题 ID 键入: values 按选项顺序保存所选选项值,并且 other 选择该行时的自由文本。拥有它们 answers 和 onAnswersChange,以及可见的问题 step 和 onStepChange,或种子 默认 属性并让卡自行运行。 onDismiss 显示角落关闭; 标签 重新表述按钮和其他行。

const [step, setStep] = useState(0);const [answers, setAnswers] = useState<QuestionnaireAnswers>({}); <Questionnaire questions={questions} step={step} onStepChange={setStep} answers={answers} onAnswersChange={setAnswers} onComplete={(final) => submitPlan(final)} onDismiss={() => setOpen(false)} labels={{ previous: "Back", next: "Continue", complete: "Send answers" }}/> {/* Or start somewhere and let the card own it */}<Questionnaire questions={questions} defaultStep={1} defaultAnswers={{ controls: { values: ["upsell"] } }} />