> ## 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.

# AppointmentScheduler

> Book and manage patient appointments with service type, specialty, and priority.

# AppointmentScheduler

A scheduling widget for creating patient appointments with full FHIR R4 field support.

## Usage

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

<AppointmentScheduler
  proxyUrl="/api/clinik"
  patientId="pt_abc123"
  practitionerId="prac_def456"
  theme="light"
/>
```

## Props

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

## Form Fields

The scheduler collects:

| Field                | Description                                                   |
| -------------------- | ------------------------------------------------------------- |
| Date & Time          | Appointment start time                                        |
| Duration             | 15, 30, 45, 60, or 90 minutes                                 |
| Appointment type     | Routine, follow-up, urgent, walk-in, check-up                 |
| Service type         | What service is being booked (e.g. "Cardiology consultation") |
| Specialty            | Required specialty (e.g. "Cardiology", "Dermatology")         |
| Priority             | Routine (0), low (1), medium (5), high (9) urgency            |
| Description          | Subject line for the appointment                              |
| Reason               | Reason for the visit                                          |
| Patient instructions | Instructions for the patient (e.g. "Fast for 12 hours")       |

## Proxy Action

The widget sends `appointments.create` with:

```json theme={null}
{
  "action": "appointments.create",
  "data": {
    "status": "booked",
    "patientId": "pt_abc123",
    "practitionerId": "prac_def456",
    "start": "2025-02-01T14:00:00Z",
    "minutesDuration": 30,
    "appointmentType": "followup",
    "serviceType": "Cardiology consultation",
    "specialty": "Cardiology",
    "priority": 0,
    "description": "Follow-up for hypertension",
    "reasonCode": "Blood pressure check",
    "patientInstruction": "Bring home BP log"
  }
}
```
