Skip to content

Add question component for choices and freeform responses - #479

Merged
ctgowrie merged 2 commits into
mainfrom
feat/question-component
Aug 21, 2026
Merged

Add question component for choices and freeform responses#479
ctgowrie merged 2 commits into
mainfrom
feat/question-component

Conversation

@ctgowrie

@ctgowrie ctgowrie commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a composable Question component for human-in-the-loop prompts that need:

  • single-choice options
  • multiple-choice options
  • a freeform text response
  • options and freeform text together

The component supports controlled and uncontrolled drafts, accessible radio/checkbox semantics, disabled states, and a structured submit result. Its onSubmit(response, event) API follows PromptInput, including support for asynchronous handlers.

Documentation includes separate interactive registry-block examples for single select, multi-select, freeform, and combined responses.

Why

AI workflows often pause to ask users for information rather than approve a tool call. Rendering those prompts inside a generic collapsible tool view can hide the action, while existing input and suggestion components do not provide one structured response surface for choices and freeform text.

Validation

  • pnpm exec oxlint packages/elements/src/question.tsx packages/elements/__tests__/question.test.tsx packages/examples/src/question.tsx packages/examples/src/question-single-select.tsx packages/examples/src/question-multi-select.tsx packages/examples/src/question-freeform.tsx
  • pnpm exec oxfmt --check packages/elements/src/question.tsx packages/elements/__tests__/question.test.tsx packages/examples/src/question.tsx packages/examples/src/question-single-select.tsx packages/examples/src/question-multi-select.tsx packages/examples/src/question-freeform.tsx 'apps/docs/content/components/(chatbot)/question.mdx'
  • pnpm exec vitest run __tests__/question.test.tsx from packages/elements (8 tests)
  • pnpm --filter docs build

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-elements Ready Ready Preview Aug 21, 2026 2:23pm

@ctgowrie
ctgowrie merged commit 6a9d5b1 into main Aug 21, 2026
13 checks passed
@ctgowrie
ctgowrie deleted the feat/question-component branch August 21, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants