Skip to main content
userTourKit
@tour-kit/surveysComponents

Components

Pre-styled display and question components: five survey containers and four accessible question input types with CVA variant support

domidex01Published Updated

Pre-built, accessible survey components. Display components control visibility based on survey state. Question components are controlled inputs that call back with typed values.

Display components

Question components

Composition pattern

Display components render their content through children. Compose question components inside:

import { SurveyModal, QuestionRating, SurveyProgress } from '@tour-kit/surveys';

<SurveyModal surveyId="nps-q1">
  <SurveyProgress current={1} total={2} />
  <QuestionRating
    id="score"
    label="How likely to recommend us (0–10)?"
    min={0}
    max={10}
    lowLabel="Not at all"
    highLabel="Extremely likely"
    onChange={(value) => survey.answer('score', value)}
  />
</SurveyModal>

Styling

All components forward className and accept standard HTML attributes via rest props. Variants are defined with CVA — import the variant functions to generate class names in custom implementations:

import {
  ratingOptionVariants,
  textInputVariants,
  selectOptionVariants,
  booleanOptionVariants,
  progressBarVariants,
} from '@tour-kit/surveys';

Headless alternative

If you need full control over markup and styling, use the headless components instead.