QuestionEditor
Typed questions for a decision model: yes/no, a choice of options, a score on levels, and a box for models that draw one, each with a name, instructions and what its answers mean.
function Editor() {
const [value, setValue] = useState<DecisionQuestion[]>(triageQuestions.slice(0, 2));
return (
<div className="w-full max-w-480">
<QuestionEditor value={value} onValueChange={setValue} />
</div>
);
}import { QuestionEditor } from "@logicplanes/kaeso-ui/playground";Props
allowBoxboolean = falseOffers the Box type, for a model that answers with a box on an image.
aria-labelstringThe group's accessible name ("Questions" by default).
disabledboolean = falseTurns off every field and button.
layout"compact" | "panel" = panelQuestions 24px apart in a panel, or 16px in a narrow column.
maxLevelsnumber = 10Levels a score takes at most (10 by default): Add level turns off there and says so.
maxOptionsnumber = 255Options a choice takes at most (255 by default): Add option turns off there and says so.
maxQuestionsnumberQuestions at most; none by default.
onValueChange(next: DecisionQuestion[]) => voidCalled with the changed questions. A question added here has an
id; empty optional text is left out.valuereadonly DecisionQuestion[]The questions, in order. Give each an
idso its fields keep their place when one above it is removed.