Question
A focused question in an inset Card. Collect an answer or guide someone through a few decisions, one at a time.
Installation
Copy the command below and run it in your terminal.
Usage
Render Question.Root in the same layout
slot as Composer.Root. Keep the prompt
value in their shared parent so swapping the forms never clears an unsent draft.
Use type="single" for one option, type="multiple" for several, or type="text" with Question.Input. Async submit handlers are
awaited and cannot run twice while unresolved. Changing type resets the bound answer to the new mode's empty value.
Composition
Set variant="inset" on Question.Root for the shared Card frame and recessed content surface. The default variant uses a plain
Card. Place Question.Actions after Question.Content to keep controls in the footer. Both parts are optional; omit the description or restyle
the actions to suit the space.
Question.Content is a static fieldset grouping for the title, description, and answer controls. Keep
navigation state and any transitions in the parent when a flow needs them. The component
itself stays still so the question remains easy to read and answer.
Keep the step index and each answer in the parent, as in the example above. Content keeps changes without resetting answers or managing navigation. Keep a flow within one answer type, or key the Root per question when mixing types: changing the type on an existing Root clears its answer. When using Cancel as Back, prevent its default behavior to avoid calling the Root’s cancellation handler.
Examples
Use the same inset composition for multiple selections, a written answer, or a question beneath a live transcript.
Multiple choice
No checks queued
Free text
Waiting for an answer
Conversation takeover
Answer or skip the question to restore the composer with its draft intact.
Anatomy
Question.Root - Renders a full question form.
Question.Title - Shows the question heading.
Question.Description - Explains the question context.
Question.Options - Wraps answer option items.
Question.Option - Represents a question option.
Question.Input - Collects a free-form response.
Question.Actions - Groups cancellation and submit actions.
Question.Cancel - Cancels question submission.
Question.Submit - Submits the selected answer.
bunx --package @sivir-ui/svelte sivir add question