Put each question in an item with a title and choices. Put the buttons in the actions and the thank-you text in QuestionnaireComplete.
first-week-survey.tsx
Questionnaire
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| item | string | — | The name of the question on screen (controlled). |
| default | string | — | The name of the first question to show (uncontrolled), for a resumed flow. |
| on | — | ||
| items | readonly QuestionnaireItemDefinition[] | — | The questions in order, for server rendering: the engine then knows the count before the questions mount. A rendered question that is not here is left out (a dev warning says so). List the choices of each question too: a choice that is not here gets no shortcut key. |
| shortcuts | "letters""numbers" | — | Keys that check a choice: letters (A–Z) or numbers (1–9). Use numbers for scripts other than Latin. |
| review | boolean | false | Adds the review step after the last question: the Submit there reads "Review answers". |
| density | "compact""default" | "default" | default: the page look (24px between parts, a 20px title). compact: a tighter look for a panel in an app (the Question Flow of the AI category): 12px between parts, the 14/20 title of a panel (the Card sm title), 6px between choices, and a line over the actions with 12px above them. |
| on | — | Sends the answers. While its promise runs, the phase is submitting (the Submit shows its loading look); when it resolves, complete; when it rejects, the answers stay and QuestionnaireSubmitError shows. Without it, the form submits as a plain form (onSubmit, an action). Catch and log your own errors inside it, then throw again to show the error. onSubmit runs first: a preventDefault there stops this call. | |
| on | — | Runs after each change of an answer (and a skip), with the answers the form would send. | |
| labels | — | ||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireProgress
<div>| Prop | Type | Default | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||
| glow | boolean | — | A soft halo in the fill color (glow, @gelatin-ui/glow). Default: false. | ||||||||||||||||||
| tone | "destructive""info""neutral""success""warning" | — | The fill color: default (primary), or a status for a task whose state has a meaning: success done, warning slow or nearly full, info a neutral step, destructive failed. Color is never the only signal: say the state in the label or value. | ||||||||||||||||||
From Base UIProgress.RootBase UI docs | |||||||||||||||||||||
| aria-valuetext | string | — | A string value that provides a user-friendly name for aria-valuenow, the current value of the progress bar. | ||||||||||||||||||
| format | NumberFormatOptions | — | Options to format the value. | ||||||||||||||||||
| get | — | Accepts a function which returns a string value that provides a human-readable text alternative for the current value of the progress bar. | |||||||||||||||||||
| |||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||
QuestionnaireCount
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
QuestionnaireContent
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireItem
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| invalid | boolean | false | |
| name | string | — | |
| multiple | boolean | — | |
| on | — | ||
| required | boolean | false | |
| max | number | — | With multiple: the most choices one can check. At the limit the others refuse a check. |
| min | number | — | With multiple: the fewest choices that count as an answer. Next (and every key that goes on) stops with "Choose at least N." in the error line while 1 to N − 1 are checked. No check at all is the required rule. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireTitle
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| render | RenderProp<RenderState> | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireDescription
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| render | RenderProp<RenderState> | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireChoices
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| render | RenderProp<QuestionnaireChoicesState> | — | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireChoice
<div>QuestionnaireChoiceDescription
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
QuestionnaireInput
<div>QuestionnaireTextarea
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| size | "default""lg""sm" | — | The padding of the box: sm, default, or lg (the height follows the text). |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireError
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| render | — | ||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireActions
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnairePrevious
<div>QuestionnaireSkip
<div>QuestionnaireNext
<div>QuestionnaireSubmit
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| busy | boolean | — | The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading. |
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | — | |
| variant | "dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary" | "default" | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
QuestionnaireKeyHint
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. |
QuestionnaireReview
<section>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <section> attributes | — | Every other attribute goes to the <section>, with a ref. |
QuestionnaireReviewTitle
<h2>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <h2> attributes | — | Every other attribute goes to the <h2>, with a ref. |
QuestionnaireReviewList
<ul>| Prop | Type | Default | Description |
|---|---|---|---|
| children | — | Your own rows (<li>), from the answers read when the review opened. | |
| ...props | <ul> attributes | — | Every other attribute goes to the <ul>, with a ref. |
QuestionnaireSubmitError
<p>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <p> attributes | — | Every other attribute goes to the <p>, with a ref. |
QuestionnaireComplete
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| Up ArroworDown Arrow | Moves between the choices. |
|---|---|
| AorBorC | Picks the choice with that letter. With shortcuts="numbers", the keys are 1 to 9. |
| Enter | Goes to the next question. |
| ModEnter | Goes on from a long answer, where Enter adds a line. |
Built with
Installs with Questionnaire











