# React Native Agenda, schedule list (Pro)

> A React Native agenda for iOS, Android and the web: the days ahead as a list under a week strip with event dots, all-day events first, start times and durations, a now line, sticky day headings and empty days. Accessible and themeable.

# Agenda Pro

The days ahead as a list, as Calendar's list view and Google Calendar's schedule show them. A [WeekStrip](../components/week-strip) on top marks days with events with dots; pick one to start the list there. Each day lists its events under its heading, all-day ones first, with their start, length and color, and a red line at now among today's. Give it a `height` and it scrolls, with day headings that stick.

```tsx
import { Agenda } from '@patine-ui/pro';
```

```tsx live full
import { Agenda } from '@patine-ui/pro';

const at = (days, h = 9, m = 0) => {
  const d = new Date();
  d.setHours(h, m, 0, 0);
  d.setDate(d.getDate() + days);
  return d;
};
const events = [
  { id: '1', title: 'Standup', start: at(0, 9), end: at(0, 9, 15), color: 'success' },
  { id: '2', title: 'Design review', start: at(0, 11), end: at(0, 12), location: 'Room 2' },
  { id: '3', title: 'Lunch with Noa', start: at(0, 12, 30), end: at(0, 13, 30), color: 'warning', location: 'Café Levinsky' },
  { id: '4', title: 'Sprint planning', start: at(1, 10), end: at(1, 11, 30) },
  { id: '5', title: 'Company offsite', start: at(2), allDay: true, color: 'danger' },
  { id: '6', title: 'Release v2', start: at(4, 14), end: at(4, 15), color: 'success' },
];

export default function Example() {
  return <Agenda events={events} height={420} onEventPress={(e) => alert(e.title)} style={{ width: 380 }} />;
}
```

## Example: a physio's day

A clinic's schedule for one therapist: appointments colored by kind, a free slot left as a gap, and pressing a booking shows its patient and notes under the list.

```tsx live full
import { useState } from 'react';
import { View } from 'react-native';
import { Box, Text } from 'patine-ui';
import { Agenda } from '@patine-ui/pro';

const at = (days: number, h: number, m = 0) => {
  const d = new Date();
  d.setDate(d.getDate() + days);
  d.setHours(h, m, 0, 0);
  return d;
};
const BOOKINGS = [
  { id: '1', title: 'New patient · knee', start: at(0, 8, 30), end: at(0, 9, 30), color: 'primary', location: 'Room 1', note: 'Referred by Dr. Jansen. Bring the MRI.' },
  { id: '2', title: 'Follow-up · shoulder', start: at(0, 9, 45), end: at(0, 10, 15), color: 'success', location: 'Room 1', note: 'Week 4 of 8. Add band work.' },
  { id: '3', title: 'Team meeting', start: at(0, 12), end: at(0, 12, 30), color: 'warning', location: 'Staff room', note: 'Rota for December.' },
  { id: '4', title: 'Sports massage', start: at(0, 14), end: at(0, 15), color: 'success', location: 'Room 2', note: 'Marathon on Sunday: keep it light.' },
  { id: '5', title: 'Follow-up · ankle', start: at(1, 9), end: at(1, 9, 30), color: 'success', location: 'Room 1', note: 'Check balance tests.' },
];

export default function Example() {
  const [picked, setPicked] = useState<(typeof BOOKINGS)[number] | null>(null);
  return (
    <View style={{ width: '100%', maxWidth: 420, gap: 12 }}>
      <Agenda events={BOOKINGS} days={2} height={380} showNowIndicator onEventPress={(e) => setPicked(BOOKINGS.find((b) => b.id === e.id) ?? null)} />
      {picked ? (
        <Box border radius="lg" padding="md" gap="xs">
          <Text weight="semibold">{picked.title}</Text>
          <Text size="sm" color="textSecondary">{picked.location}</Text>
          <Text>{picked.note}</Text>
        </Box>
      ) : null}
    </View>
  );
}
```

## Events

Events are the same as the [event calendar's](./event-calendar): `{ id, title, start, end?, allDay?, color?, location?, description?, data? }`. A missing `end` is an hour after `start` (or the whole day for all-day events); an event across midnight shows on each day it touches.

## Range and empty days

The list starts at `date` (controlled with `onDateChange`, or `defaultDate`; the week strip sets it) and runs `days` days (14). Days with nothing on are left out; `showEmptyDays` lists them as "No events". `showWeekStrip={false}` drops the strip, and `showNowIndicator={false}` the now line.

```tsx live full
import { Agenda } from '@patine-ui/pro';

const at = (days, h) => {
  const d = new Date();
  d.setHours(h, 0, 0, 0);
  d.setDate(d.getDate() + days);
  return d;
};
const classes = [
  { id: 'a', title: 'Yoga', start: at(1, 7), end: at(1, 8), color: '#10B981', location: 'Studio A' },
  { id: 'b', title: 'Spin', start: at(3, 18), end: at(3, 19), color: '#F59E0B', location: 'Studio B' },
];

export default function Example() {
  const [day, setDay] = React.useState(new Date());
  return <Agenda events={classes} date={day} onDateChange={setDay} days={5} showEmptyDays style={{ width: 380 }} />;
}
```

## Your own rows

`renderEvent({ event, start, end, time, color, theme })` draws an event's text; the row keeps its time, color bar and press.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `events` | `CalendarEvent[]` | — | `{ id, title, start, end?, allDay?, color?, location?, description?, data? }` |
| `date` / `defaultDate` / `onDateChange` | `Date` | today | The first day listed. |
| `days` | `number` | `14` | |
| `showWeekStrip` | `boolean` | `true` | |
| `showEmptyDays` | `boolean` | `false` | |
| `showNowIndicator` | `boolean` | `true` | |
| `height` | `number` | — | Scrolls, with sticky headings. |
| `onEventPress` | `(event) => void` | — | |
| `firstDayOfWeek` / `locale` / `hour12` / `now` | | | |
| `renderEvent` | `(info) => ReactNode` | — | |
| `loading` / `error` / `onRetry` / `emptyTitle` / `emptyDescription` / `renderEmpty` | | | States. |
| `density` / `animate` / `labels` / `design` / `theme` / `accessibilityLabel` / `style` | | | |
