@survey-kit/core
v0.1.1
Published
Core survey framework for rendering surveys from JSON/YAML configuration
Readme
@survey-kit/core
Core survey framework for rendering surveys from JSON/YAML configuration.
Overview
The core package provides the essential logic and components for building surveys:
- Survey renderer – Renders surveys from configuration
- Layout renderer – Handles page layout, sidebar, and navigation
- State management –
useSurveyhook for survey state and navigation - Type definitions – TypeScript types for survey and layout configuration
- Validation – Built-in validation with cross-question support
- Conditional logic – Show/hide questions and pages based on answers
- Navigation – Configurable navigation rules (sequential or free-form)
Features
- Full TypeScript support
- Conditional logic and skip logic
- Advanced validation (including cross-question validation)
- Hierarchical survey structure (stages → groups → pages → questions)
- Progress tracking at multiple levels
- Mobile-first, accessible design
Installation
npm install @survey-kit/coreUsage
import { SurveyRenderer, useSurvey } from '@survey-kit/core'
import type { SurveyConfig } from '@survey-kit/core'
const config: SurveyConfig = {
id: 'my-survey',
title: 'My Survey',
stages: [
// ... survey configuration
],
}
function MySurvey() {
return (
<SurveyRenderer
config={config}
components={components}
onSubmit={handleSubmit}
/>
)
}Key Exports
SurveyRenderer– Main component for rendering surveysLayoutRenderer– Component for rendering survey layoutuseSurvey– Hook for survey state management- Type definitions (
SurveyConfig,SurveyPage,SurveyQuestion, etc.) - Conditional logic utilities
- Validation utilities
Requirements
- React 19+
@survey-kit/registry(peer dependency)
Licence
MIT
