Questions
nexus-ui/questionsFreeComponent
Follow-up clarification questions with single or multiple choice, carousel navigation, and batch submission
Live preview
live · rendered by the registry
Rendered by nexus-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://nexus-ui.dev/r/questions.jsonSource
1"use client";23import * as React from "react";4import {5 ArrowLeft01Icon,6 ArrowRight01Icon,7 Cancel01Icon,8 Edit03Icon,9} from "@hugeicons/core-free-icons";10import { HugeiconsIcon } from "@hugeicons/react";1112import { Button } from "@/components/ui/button";13import {14 Card,15 CardContent,16 CardFooter,17 CardHeader,18 CardTitle,19} from "@/components/ui/card";20import { Checkbox } from "@/components/ui/checkbox";21import {22 Carousel,23 CarouselContent,24 CarouselItem,25 type CarouselApi,26} from "@/components/ui/carousel";27import { cn } from "@/lib/utils";2829export type QuestionType = "single" | "multiple";3031export type QuestionOptionInput = {32 value: string;33 label: React.ReactNode;34};3536export type QuestionInput = {37 id: string;38 type: QuestionType;39 prompt: React.ReactNode;40 options: QuestionOptionInput[];41 required?: boolean;42};4344export const QUESTION_OTHER_VALUE = "__other__";45export const QUESTION_NO_PREFERENCE_VALUE = "__no_preference__";46export const QUESTION_NO_PREFERENCE_LABEL = "[No Preference]";4748export type RegisteredQuestion = {49 id: string;50 type: QuestionType;51 prompt: React.ReactNode;52 required?: boolean;53 index: number;54 options?: QuestionOptionInput[];55};5657type QuestionScope = {58 id: string;59 type: QuestionType;60};6162export type QuestionSubmissionAnswer = {63 value: string;64 label: React.ReactNode;65};6667const NO_PREFERENCE_ANSWER: QuestionSubmissionAnswer = {68 value: QUESTION_NO_PREFERENCE_VALUE,69 label: QUESTION_NO_PREFERENCE_LABEL,70};7172export type SingleQuestionAnswerState = {73 type: "single";74 value: string;75 other?: string;76};7778export type MultipleQuestionAnswerState = {79 type: "multiple";80 value: string[];81 other?: string;82};8384export type QuestionAnswerState =85 | SingleQuestionAnswerState86 | MultipleQuestionAnswerState;8788export type QuestionsSubmission = Array<89 | {90 questionId: string;91 prompt: React.ReactNode;92 type: "single";93 status: "answered";94 answer: QuestionSubmissionAnswer;95 }96 | {97 questionId: string;98 prompt: React.ReactNode;99 type: "single";100 status: "skipped";101 answer: QuestionSubmissionAnswer;102 }103 | {104 questionId: string;105 prompt: React.ReactNode;106 type: "multiple";107 status: "answered";108 answer: QuestionSubmissionAnswer[];109 }110 | {111 questionId: string;112 prompt: React.ReactNode;113 type: "multiple";114 status: "skipped";115 answer: QuestionSubmissionAnswer[];116 }117>;118119// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from nexus-ui
All 15 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Attachmentsattachments | nexus-ui | Components | Free | 4 deps · 2 files | |
| Chain of Thoughtchain-of-thought | nexus-ui | Components | Free | 2 deps · 2 files | |
| Citationcitation | nexus-ui | Components | Free | 4 deps | |
| Feedback Barfeedback-bar | nexus-ui | Components | Free | 1 dep | |
| Imageimage | nexus-ui | Components | Free | 2 deps | |
| Messagemessage | nexus-ui | Components | Free | 9 deps · 2 files | |
| Model Selectormodel-selector | nexus-ui | Components | Free | 3 deps | |
| Prompt Inputprompt-input | nexus-ui | Components | Free | 1 dep |
