- Prop
items- Type
readonly QuestionnaireItem[]- Default
- —
- Requirement
- required
- Description
- —
Docs Components Forms
Questionnaire
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
const questionnaireFixture = { id: "questionnaire", shortcuts: "letters", items: [ { name: "working-style", prompt: "How should this agent work?", description: "Choose the level of autonomy that fits this project.", required: true, multiple: false, choices: [ { value: "guided", label: "Ask before acting", description: "Confirm each material change before continuing.", }, { value: "routine", label: "Run routine steps", description: "Proceed independently for safe, reversible work.", }, { value: "draft", label: "Draft only", description: "Prepare changes without applying them.", }, ], }, { name: "safeguards", prompt: "Which safeguards should it apply?", description: "Choose any that matter, or skip this step.", required: false, multiple: true, skippable: true, choices: [ { value: "tests", label: "Run focused tests", description: "Verify changed behavior before handoff.", }, { value: "docs", label: "Update documentation", description: "Keep usage guidance aligned with the change.", }, { value: "review", label: "Request a review", description: "Pause for another person to inspect the result.", }, ], }, { name: "context", prompt: "What context should it know?", description: "Add one constraint, convention, or goal before submitting.", required: true, input: { label: "Project context", placeholder: "Constraints, conventions, or goals", type: "text", }, }, ],} as const; import { Questionnaire } from "@grassroot/ui-react"; export default function QuestionnaireDemo() { return ( <div className="w-full max-w-xl"> <Questionnaire items={questionnaireFixture.items} shortcuts={questionnaireFixture.shortcuts} /> </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">const questionnaireFixture = { id: "questionnaire", shortcuts: "letters", items: [ { name: "working-style", prompt: "How should this agent work?", description: "Choose the level of autonomy that fits this project.", required: true, multiple: false, choices: [ { value: "guided", label: "Ask before acting", description: "Confirm each material change before continuing.", }, { value: "routine", label: "Run routine steps", description: "Proceed independently for safe, reversible work.", }, { value: "draft", label: "Draft only", description: "Prepare changes without applying them.", }, ], }, { name: "safeguards", prompt: "Which safeguards should it apply?", description: "Choose any that matter, or skip this step.", required: false, multiple: true, skippable: true, choices: [ { value: "tests", label: "Run focused tests", description: "Verify changed behavior before handoff.", }, { value: "docs", label: "Update documentation", description: "Keep usage guidance aligned with the change.", }, { value: "review", label: "Request a review", description: "Pause for another person to inspect the result.", }, ], }, { name: "context", prompt: "What context should it know?", description: "Add one constraint, convention, or goal before submitting.", required: true, input: { label: "Project context", placeholder: "Constraints, conventions, or goals", type: "text", }, }, ],} as const; import { Questionnaire } from "@grassroot/ui-vue";</script> <template> <div class="w-full max-w-xl"> <Questionnaire :items="questionnaireFixture.items" :shortcuts="questionnaireFixture.shortcuts" /> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";const questionnaireFixture = { id: "questionnaire", shortcuts: "letters", items: [ { name: "working-style", prompt: "How should this agent work?", description: "Choose the level of autonomy that fits this project.", required: true, multiple: false, choices: [ { value: "guided", label: "Ask before acting", description: "Confirm each material change before continuing.", }, { value: "routine", label: "Run routine steps", description: "Proceed independently for safe, reversible work.", }, { value: "draft", label: "Draft only", description: "Prepare changes without applying them.", }, ], }, { name: "safeguards", prompt: "Which safeguards should it apply?", description: "Choose any that matter, or skip this step.", required: false, multiple: true, skippable: true, choices: [ { value: "tests", label: "Run focused tests", description: "Verify changed behavior before handoff.", }, { value: "docs", label: "Update documentation", description: "Keep usage guidance aligned with the change.", }, { value: "review", label: "Request a review", description: "Pause for another person to inspect the result.", }, ], }, { name: "context", prompt: "What context should it know?", description: "Add one constraint, convention, or goal before submitting.", required: true, input: { label: "Project context", placeholder: "Constraints, conventions, or goals", type: "text", }, }, ],} as const; import { GrassrootQuestionnaire } from "@grassroot/ui-angular/questionnaire"; @Component({ selector: "app-questionnaire-demo", standalone: true, imports: [GrassrootQuestionnaire], host: { style: "display: contents" }, template: ` <div class="w-full max-w-xl"> <grassroot-questionnaire [items]="fixture.items" [shortcuts]="fixture.shortcuts" /> </div> `,})export class QuestionnaireDemoComponent { protected readonly fixture = questionnaireFixture;} export default QuestionnaireDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> const questionnaireFixture = { id: "questionnaire", shortcuts: "letters", items: [ { name: "working-style", prompt: "How should this agent work?", description: "Choose the level of autonomy that fits this project.", required: true, multiple: false, choices: [ { value: "guided", label: "Ask before acting", description: "Confirm each material change before continuing.", }, { value: "routine", label: "Run routine steps", description: "Proceed independently for safe, reversible work.", }, { value: "draft", label: "Draft only", description: "Prepare changes without applying them.", }, ], }, { name: "safeguards", prompt: "Which safeguards should it apply?", description: "Choose any that matter, or skip this step.", required: false, multiple: true, skippable: true, choices: [ { value: "tests", label: "Run focused tests", description: "Verify changed behavior before handoff.", }, { value: "docs", label: "Update documentation", description: "Keep usage guidance aligned with the change.", }, { value: "review", label: "Request a review", description: "Pause for another person to inspect the result.", }, ], }, { name: "context", prompt: "What context should it know?", description: "Add one constraint, convention, or goal before submitting.", required: true, input: { label: "Project context", placeholder: "Constraints, conventions, or goals", type: "text", }, }, ], } as const; import { Questionnaire } from "@grassroot/ui-svelte";</script> <div class="w-full max-w-xl"> <Questionnaire items={questionnaireFixture.items} shortcuts={questionnaireFixture.shortcuts} /></div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */const questionnaireFixture = { id: "questionnaire", shortcuts: "letters", items: [ { name: "working-style", prompt: "How should this agent work?", description: "Choose the level of autonomy that fits this project.", required: true, multiple: false, choices: [ { value: "guided", label: "Ask before acting", description: "Confirm each material change before continuing.", }, { value: "routine", label: "Run routine steps", description: "Proceed independently for safe, reversible work.", }, { value: "draft", label: "Draft only", description: "Prepare changes without applying them.", }, ], }, { name: "safeguards", prompt: "Which safeguards should it apply?", description: "Choose any that matter, or skip this step.", required: false, multiple: true, skippable: true, choices: [ { value: "tests", label: "Run focused tests", description: "Verify changed behavior before handoff.", }, { value: "docs", label: "Update documentation", description: "Keep usage guidance aligned with the change.", }, { value: "review", label: "Request a review", description: "Pause for another person to inspect the result.", }, ], }, { name: "context", prompt: "What context should it know?", description: "Add one constraint, convention, or goal before submitting.", required: true, input: { label: "Project context", placeholder: "Constraints, conventions, or goals", type: "text", }, }, ],} as const; import { Questionnaire } from "@grassroot/ui-solid";import type { JSX } from "solid-js"; export default function QuestionnaireDemo(): JSX.Element { return ( <div class="w-full max-w-xl"> <Questionnaire items={questionnaireFixture.items} shortcuts={questionnaireFixture.shortcuts} /> </div> );}Installation
API Reference
Import
import { Questionnaire } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
Description
itemsreadonly QuestionnaireItem[]—
required
—
itemstring | undefined—
optional
Controlled active item name.
defaultItemstring | undefined—
optional
Initial active item for uncontrolled use.
answersreadonly QuestionnaireAnswer[] | undefined—
optional
Controlled answers.
defaultAnswersreadonly QuestionnaireAnswer[] | undefined—
optional
Initial answers for uncontrolled use and native reset.
shortcutsQuestionnaireShortcutMode | undefined—
optional
—
previousLabelstring | undefined—
optional
—
nextLabelstring | undefined—
optional
—
skipLabelstring | undefined—
optional
—
submitLabelstring | undefined—
optional
—
noValidateboolean | undefinedtrueoptional
Disable native constraint validation; Questionnaire renders its own errors.
onItemChange((item: string) => void) | undefined—
optional
—
onAnswersChange((answers: readonly QuestionnaireAnswer[]) => void) | undefined—
optional
—
onSubmit((answers: readonly QuestionnaireAnswer[], formData: FormData) => void) | undefined—
optional
—
- Prop
item- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- Controlled active item name.
- Prop
defaultItem- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- Initial active item for uncontrolled use.
- Prop
answers- Type
readonly QuestionnaireAnswer[] | undefined- Default
- —
- Requirement
- optional
- Description
- Controlled answers.
- Prop
defaultAnswers- Type
readonly QuestionnaireAnswer[] | undefined- Default
- —
- Requirement
- optional
- Description
- Initial answers for uncontrolled use and native reset.
- Prop
shortcuts- Type
QuestionnaireShortcutMode | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
previousLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
nextLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
skipLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
submitLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
noValidate- Type
boolean | undefined- Default
true- Requirement
- optional
- Description
- Disable native constraint validation; Questionnaire renders its own errors.
- Prop
onItemChange- Type
((item: string) => void) | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
onAnswersChange- Type
((answers: readonly QuestionnaireAnswer[]) => void) | undefined- Default
- —
- Requirement
- optional
- Description
- —
- Prop
onSubmit- Type
((answers: readonly QuestionnaireAnswer[], formData: FormData) => void) | undefined- Default
- —
- Requirement
- optional
- Description
- —
Events
| Event | Payload |
|---|---|
onItemChange | ((item: string) => void) | undefined |
onAnswersChange | ((answers: readonly QuestionnaireAnswer[]) => void) | undefined |
onSubmit | ((answers: readonly QuestionnaireAnswer[], formData: FormData) => void) | undefined |
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { Questionnaire } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
itemsreadonly QuestionnaireItem[]—
required
itemstring | undefined—
optional
defaultItemstring | undefined—
optional
answersreadonly QuestionnaireAnswer[] | undefined—
optional
defaultAnswersreadonly QuestionnaireAnswer[] | undefined() => []optional
shortcutsQuestionnaireShortcutMode | undefined—
optional
previousLabelstring | undefinedquestionnaireDefaults.previousLabeloptional
nextLabelstring | undefinedquestionnaireDefaults.nextLabeloptional
skipLabelstring | undefinedquestionnaireDefaults.skipLabeloptional
submitLabelstring | undefinedquestionnaireDefaults.submitLabeloptional
noValidateboolean | undefinedtrueoptional
- Prop
items- Type
readonly QuestionnaireItem[]- Default
- —
- Requirement
- required
- Prop
item- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
defaultItem- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
answers- Type
readonly QuestionnaireAnswer[] | undefined- Default
- —
- Requirement
- optional
- Prop
defaultAnswers- Type
readonly QuestionnaireAnswer[] | undefined- Default
() => []- Requirement
- optional
- Prop
shortcuts- Type
QuestionnaireShortcutMode | undefined- Default
- —
- Requirement
- optional
- Prop
previousLabel- Type
string | undefined- Default
questionnaireDefaults.previousLabel- Requirement
- optional
- Prop
nextLabel- Type
string | undefined- Default
questionnaireDefaults.nextLabel- Requirement
- optional
- Prop
skipLabel- Type
string | undefined- Default
questionnaireDefaults.skipLabel- Requirement
- optional
- Prop
submitLabel- Type
string | undefined- Default
questionnaireDefaults.submitLabel- Requirement
- optional
- Prop
noValidate- Type
boolean | undefined- Default
true- Requirement
- optional
Events
| Event | Payload |
|---|---|
update:item | [item: string] |
update:answers | [answers: readonly QuestionnaireAnswer[]] |
submit | [answers: readonly QuestionnaireAnswer[], formData: FormData] |
Import
import { Component } from "@angular/core";
import { GrassrootQuestionnaire } from "@grassroot/ui-angular/questionnaire";
Props
Prop
Type
Default
Requirement
itemsreadonly QuestionnaireItem[]—
required
itemstring—
optional
defaultItemstring—
optional
answersreadonly QuestionnaireAnswer[]—
optional
defaultAnswersreadonly QuestionnaireAnswer[][]optional
shortcutsQuestionnaireShortcutMode—
optional
previousLabelstringquestionnaireDefaults.previousLabeloptional
nextLabelstringquestionnaireDefaults.nextLabeloptional
skipLabelstringquestionnaireDefaults.skipLabeloptional
submitLabelstringquestionnaireDefaults.submitLabeloptional
noValidatebooleantrueoptional
classNamestring—
optional
- Prop
items- Type
readonly QuestionnaireItem[]- Default
- —
- Requirement
- required
- Prop
item- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultItem- Type
string- Default
- —
- Requirement
- optional
- Prop
answers- Type
readonly QuestionnaireAnswer[]- Default
- —
- Requirement
- optional
- Prop
defaultAnswers- Type
readonly QuestionnaireAnswer[]- Default
[]- Requirement
- optional
- Prop
shortcuts- Type
QuestionnaireShortcutMode- Default
- —
- Requirement
- optional
- Prop
previousLabel- Type
string- Default
questionnaireDefaults.previousLabel- Requirement
- optional
- Prop
nextLabel- Type
string- Default
questionnaireDefaults.nextLabel- Requirement
- optional
- Prop
skipLabel- Type
string- Default
questionnaireDefaults.skipLabel- Requirement
- optional
- Prop
submitLabel- Type
string- Default
questionnaireDefaults.submitLabel- Requirement
- optional
- Prop
noValidate- Type
boolean- Default
true- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
itemChange | string |
answersChange | readonly QuestionnaireAnswer[] |
submit | QuestionnaireSubmitDetail |
Import
import { Questionnaire } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
itemsreadonly QuestionnaireItem[]—
required
itemstring—
optional
defaultItemstring—
optional
answersreadonly QuestionnaireAnswer[]—
optional
defaultAnswersreadonly QuestionnaireAnswer[]—
optional
shortcutsQuestionnaireShortcutMode—
optional
previousLabelstring—
optional
nextLabelstring—
optional
skipLabelstring—
optional
submitLabelstring—
optional
noValidatebooleantrueoptional
onItemChange(item: string) => void—
optional
onAnswersChange(answers: readonly QuestionnaireAnswer[]) => void—
optional
onSubmit(answers: readonly QuestionnaireAnswer[], formData: FormData) => void—
optional
- Prop
items- Type
readonly QuestionnaireItem[]- Default
- —
- Requirement
- required
- Prop
item- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultItem- Type
string- Default
- —
- Requirement
- optional
- Prop
answers- Type
readonly QuestionnaireAnswer[]- Default
- —
- Requirement
- optional
- Prop
defaultAnswers- Type
readonly QuestionnaireAnswer[]- Default
- —
- Requirement
- optional
- Prop
shortcuts- Type
QuestionnaireShortcutMode- Default
- —
- Requirement
- optional
- Prop
previousLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
nextLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
skipLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
submitLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
noValidate- Type
boolean- Default
true- Requirement
- optional
- Prop
onItemChange- Type
(item: string) => void- Default
- —
- Requirement
- optional
- Prop
onAnswersChange- Type
(answers: readonly QuestionnaireAnswer[]) => void- Default
- —
- Requirement
- optional
- Prop
onSubmit- Type
(answers: readonly QuestionnaireAnswer[], formData: FormData) => void- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onItemChange | (item: string) => void |
onAnswersChange | (answers: readonly QuestionnaireAnswer[]) => void |
onSubmit | (answers: readonly QuestionnaireAnswer[], formData: FormData) => void |
Import
import { Questionnaire } from "@grassroot/ui-solid";
import type { JSX } from "solid-js";
Props
Prop
Type
Default
Requirement
itemsreadonly QuestionnaireItem[]—
required
itemstring—
optional
defaultItemstring—
optional
answersreadonly QuestionnaireAnswer[]—
optional
defaultAnswersreadonly QuestionnaireAnswer[]—
optional
shortcutsQuestionnaireShortcutMode—
optional
previousLabelstring—
optional
nextLabelstring—
optional
skipLabelstring—
optional
submitLabelstring—
optional
noValidatebooleantrueoptional
onItemChange(item: string) => void—
optional
onAnswersChange(answers: readonly QuestionnaireAnswer[]) => void—
optional
onSubmit(answers: readonly QuestionnaireAnswer[], formData: FormData) => void—
optional
- Prop
items- Type
readonly QuestionnaireItem[]- Default
- —
- Requirement
- required
- Prop
item- Type
string- Default
- —
- Requirement
- optional
- Prop
defaultItem- Type
string- Default
- —
- Requirement
- optional
- Prop
answers- Type
readonly QuestionnaireAnswer[]- Default
- —
- Requirement
- optional
- Prop
defaultAnswers- Type
readonly QuestionnaireAnswer[]- Default
- —
- Requirement
- optional
- Prop
shortcuts- Type
QuestionnaireShortcutMode- Default
- —
- Requirement
- optional
- Prop
previousLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
nextLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
skipLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
submitLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
noValidate- Type
boolean- Default
true- Requirement
- optional
- Prop
onItemChange- Type
(item: string) => void- Default
- —
- Requirement
- optional
- Prop
onAnswersChange- Type
(answers: readonly QuestionnaireAnswer[]) => void- Default
- —
- Requirement
- optional
- Prop
onSubmit- Type
(answers: readonly QuestionnaireAnswer[], formData: FormData) => void- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Events
| Event | Payload |
|---|---|
onItemChange | (item: string) => void |
onAnswersChange | (answers: readonly QuestionnaireAnswer[]) => void |
onSubmit | (answers: readonly QuestionnaireAnswer[], formData: FormData) => void |