Prodular UI

Questionnaire

AI

Structured questions an assistant asks before it acts, one step at a time, with keyboard shortcuts for the choices.

npx prodular-ui add questionnaire

Clarifying questions

Two steps with progress. Number keys pick a choice and Enter moves on.

Copilot needs two answers before it forecasts

Multiple choice with a note

Checkboxes plus a free text field for anything the choices miss.

Anatomy

<Questionnaire onSubmit={send}>  <QuestionnaireItem name="horizon" required>    <QuestionnaireTitle>How far ahead?</QuestionnaireTitle>    <QuestionnaireChoices>      <QuestionnaireChoice value="13w">13 weeks</QuestionnaireChoice>    </QuestionnaireChoices>    <QuestionnaireActions><QuestionnaireSubmit /></QuestionnaireActions>  </QuestionnaireItem></Questionnaire>

Guidance

Use it when

  • When the assistant needs a decision before a long or costly task: a forecast, a migration, sending emails.
  • Two to four choices per question, each a complete answer.

Avoid

  • Asking what the assistant could look up itself.
  • More than three questions. Ask the rest later or pick defaults and say so.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Render the questionnaire inside the assistant Message that asks it, not as a modal.
  • Give every QuestionnaireItem a unique name and mark required items. Use multiple for checkbox questions.
  • Write titles as questions ending in a question mark, and choices as answers, not as Yes or No alone.
  • On submit, send the answers back as a user message so the thread keeps a record of what was chosen.

API

Questionnaire

PropTypeDefaultDescription
shortcuts"letters" | "numbers"Keyboard shortcuts for choices.
onSubmitFormEventHandlerCalled when the last step is sent.

QuestionnaireItem

PropTypeDefaultDescription
name / required / multiplestring, boolean, booleanOne question.

QuestionnaireChoice

PropTypeDefaultDescription
valuestringChoice value.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add questionnaire# or, with the registry in components.jsonnpx shadcn@latest add @prodular/questionnaire