> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clinikapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IntakeForm

> Patient intake questionnaire widget with structured FHIR answers.

# IntakeForm

A dynamic intake form that submits responses as FHIR QuestionnaireResponse resources. Supports all FHIR answer types including text, boolean, integer, decimal, date, time, coded values, quantities, and URIs.

## Usage

```tsx theme={null}
import { IntakeForm } from '@clinikapi/react';

<IntakeForm
  proxyUrl="/api/clinik"
  patientId="pt_abc123"
  theme="light"
/>
```

## Props

| Prop        | Type                | Required | Description       |
| ----------- | ------------------- | -------- | ----------------- |
| `proxyUrl`  | `string`            | Yes      | Backend proxy URL |
| `patientId` | `string`            | Yes      | Patient ID        |
| `theme`     | `'light' \| 'dark'` | No       | Color theme       |

## Supported Answer Types

The intake form maps to FHIR QuestionnaireResponse answer types:

| Type        | Field           | Example                       |
| ----------- | --------------- | ----------------------------- |
| Text        | `valueString`   | Free-text answers             |
| Yes/No      | `valueBoolean`  | `true` / `false`              |
| Integer     | `valueInteger`  | Whole numbers                 |
| Decimal     | `valueDecimal`  | Decimal numbers               |
| Date        | `valueDate`     | `"2024-06-15"`                |
| Date-Time   | `valueDateTime` | `"2025-01-15T10:00:00Z"`      |
| Time        | `valueTime`     | `"14:30:00"`                  |
| Coded       | `valueCoding`   | SNOMED, ICD codes             |
| Measurement | `valueQuantity` | `{ value: 165, unit: "lbs" }` |
| URI         | `valueUri`      | External references           |

## Features

* Dynamic question rendering
* Nested question groups (unlimited depth)
* Multiple answer types per question
* Auto-save as `in-progress`, submit as `completed`
* Support for `basedOn` (ServiceRequest/CarePlan references)
* Support for `partOf` (Observation/Procedure references)

## Proxy Action

The widget sends `intakes.submit` with:

```json theme={null}
{
  "action": "intakes.submit",
  "data": {
    "patientId": "pt_abc123",
    "status": "completed",
    "items": [
      {
        "linkId": "chief-complaint",
        "text": "Primary reason for visit",
        "answer": [{ "valueString": "Annual physical exam" }]
      },
      {
        "linkId": "pain-level",
        "text": "Current pain level (0-10)",
        "answer": [{ "valueInteger": 3 }]
      }
    ]
  }
}
```
