# Slot Picker
> Book a meeting on a day rail. Drag a meeting into a free gap; it hops over existing bookings, resizes in place and shows the host's local time.

Source: https://kokonutui.com/docs/inputs/slot-picker

## Installation

```bash
npx shadcn@latest add @kokonutui/slot-picker
```

## Props

| Prop     | Type                                                         | Default                             | Description                                                                                          |
|----------|--------------------------------------------------------------|-------------------------------------|------------------------------------------------------------------------------------------------------|
| `host?`  | `{ name: string; title?: string; city?: string; offset?: number }` | `{ name: "Lena Ortiz", title: "Product walkthrou…` | Who you're booking. `offset` is their clock minus yours, in minutes.                               |
| `days?`  | `SlotDay[]`                                                 | `demo`                              |                                                                                                      |
| `durations?` | `number[]`                                               | `[30, 60, 90]`                         | Lengths offered, in minutes.                                                                         |
| `timezone?` | `string`                                                | `"Eastern Time, New York"`         | The guest's time zone, shown under the rail.                                                       |
| `onBook?` | `(slot: { date: string; start: number; minutes: number }) => void`  |                                     |                                                                                                      |
| `className?` | `string`                                                |                                     | Extra classes for the root element.                                                                  |

### SlotDay

| Field | Type     | Description                                                                |
|-------|----------|----------------------------------------------------------------------------|
| `date`| `string` | YYYY-MM-DD                                                                |
| `open`| `Span`   | Hours you can be booked, in minutes from midnight, in the guest's time. |
| `busy`| `Span[]` | Meetings already in the calendar.                                          |

### Span

Minutes from midnight.

```ts
type Span = [number, number];
```

## Source

```tsx
// Code example omitted for brevity
```

/** Booking a meeting on a real day rail. Click a free gap and the meeting lands there; drag it and it hops over what's already booked instead of sliding under it. Change the length and it grows in place, moving only if it no longer fits. */
export default function SlotPicker({
  host = {
    name: "Lena Ortiz",
    title: "Product walkthrough",
    city: "Lisbon",
    offset: 300,
  },
  days = DEMO_DAYS,
  durations = [30, 60, 90],
  timezone = "Eastern Time, New York",
  onBook,
  className,
}: SlotPickerProps) {
  // Implementation omitted for brevity
}
