# Meeting invite form

> A React Native meeting invite form for iOS, Android and the web: the date and time in one field with 15-minute steps, the length as a segmented control, a time zone select, and guests picked as chips from a searchable list. One file, built with Patine's DateTimePickerField, SegmentedControl and Select.

# Meeting invite

A new meeting: when (date and time in one field, in 15-minute steps), how long, which time zone, and who's invited, picked as chips. **Send invite** sums it up.

```tsx live device
import { useState } from 'react';
import { ScrollView, StyleSheet, View } from 'react-native';
import { Button, DateTimePickerField, formatDate, Heading, SegmentedControl, Select, Text, useTheme } from 'patine-ui';

const LENGTHS = [15, 30, 45, 60].map((minutes) => ({ label: `${minutes} min`, value: minutes }));
const ZONES = ['Lisbon · WET', 'London · GMT', 'New York · EST', 'Tel Aviv · IST', 'Tokyo · JST'].map((label) => ({ label, value: label }));
const PEOPLE = [
  { label: 'Maya Levi', value: 'maya', description: 'Design' },
  { label: 'Rafael Mendes', value: 'rafael', description: 'Engineering' },
  { label: 'Lea Martin', value: 'lea', description: 'Engineering' },
  { label: 'Omer Katz', value: 'omer', description: 'Product' },
  { label: 'Yuki Tanaka', value: 'yuki', description: 'Research' },
  { label: 'Dana Cohen', value: 'dana', description: 'Marketing' },
];
const inThreeDays = () => {
  const day = new Date();
  day.setDate(day.getDate() + 3);
  day.setHours(10, 30, 0, 0);
  return day;
};

export default function MeetingInvite() {
  const { colors } = useTheme();
  const [when, setWhen] = useState(inThreeDays);
  const [length, setLength] = useState(30);
  const [zone, setZone] = useState<string | null>('Lisbon · WET');
  const [guests, setGuests] = useState(['maya', 'rafael']);
  const [sending, setSending] = useState(false);
  const [sent, setSent] = useState(false);

  const send = () => {
    setSending(true);
    setTimeout(() => {
      setSending(false);
      setSent(true);
    }, 1000);
  };

  return (
    <View style={[styles.screen, { backgroundColor: colors.background }]}>
      <ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
        <View style={styles.titles}>
          <Heading level={2}>New meeting</Heading>
          <Text color="textSecondary">
            {formatDate(when, undefined, { weekday: 'long', hour: 'numeric', minute: '2-digit' })} · {length} min · {guests.length} guests
          </Text>
        </View>
        <DateTimePickerField label="When" value={when} onConfirm={setWhen} minuteInterval={15} />
        <Text weight="medium">Length</Text>
        <SegmentedControl items={LENGTHS} value={length} onValueChange={setLength} accessibilityLabel="Length" />
        <Select label="Time zone" options={ZONES} value={zone} onValueChange={setZone} />
        <Select label="Guests" options={PEOPLE} multiple chips value={guests} onValueChange={setGuests} searchable />
      </ScrollView>
      <View style={styles.footer}>
        <Button size="lg" loading={sending} disabled={!guests.length} onPress={send}>
          {sent ? 'Invite sent' : `Send invite to ${guests.length}`}
        </Button>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  screen: { flex: 1 },
  content: { gap: 14, padding: 20 },
  titles: { gap: 4, marginBottom: 4 },
  footer: { padding: 16 },
});
```

## Components used

- [DateTimePickerField](/docs/components/date-time-picker): the date and the time in one field, with `minuteInterval`
- [SegmentedControl](/docs/components/segmented-control): the length
- [Select](/docs/components/select): the time zone, and the guests with `multiple`, `chips` and `searchable`
- [Button](/docs/components/button), [Heading, Text](/docs/components/text)

## How it works

- **One field for when.** `DateTimePickerField` opens a date and a time together, wheels on iOS, a calendar then a clock in Material, and a dropdown on the web, and confirms both at once.
- **Guests as chips.** With `multiple` and `chips`, each pick shows in the field and can be removed there.
- **Store the time zone with the meeting.** The `Date` is the moment; the zone says how to show it to everyone else.
