Blocks / Slot picker

Slot picker

A day strip or a month, then the times: duration, time zone with its offset, taken and past slots struck, one chosen. For bookings.

import { SlotPicker, daySlots } from "@forgeron/ui";
/01 → Strip
30 minEurope/Paris UTC+1

Nov 18 · Wednesday

import { SlotPicker, defaultWeekly } from "@forgeron/ui";

export default function Strip() {
  return (
    <SlotPicker
      availability={{ timezone: "Europe/Paris", weekly: defaultWeekly(), exceptions: [] }}
      busy={[{ date: "2026-11-18", start: "10:00", end: "11:00" }]}
      duration={30}
      defaultDate="2026-11-18"
      now="2026-11-18T09:40"
      confirmLabel="Book"
      onConfirm={() => {}}
    />
  );
}
/02 → Calendar and zone
1 h
November 2026
MTWTFSS

Nov 18 · Wednesday

// A month beside the times; the viewer reads them in their own zone.
import { SlotPicker, defaultWeekly } from "@forgeron/ui";

export default function CalendarAndZone() {
  return (
    <SlotPicker
      layout="calendar"
      availability={{ timezone: "Europe/Paris", weekly: defaultWeekly(), exceptions: [] }}
      duration={60}
      defaultDate="2026-11-18"
      defaultTimezone="America/New_York"
      now="2026-11-18T04:00"
    />
  );
}
API → Props
PropTypeDefaultDescription
value / defaultValueSlotChoice | null—{ date, time, timezone, duration, host } in the zone shown, and the same moment where the hours are written. Controlled or not.
onChange(slot: SlotChoice | null) => void—A click on a free time chooses it; another click removes it.
availability / busyAvailability / BusyBlock[]—Hours and time already taken: the slots are computed from them.
slots{ date, time, available? }[]—Slots given as they are (a server's answer), in the host's zone; they replace the computation.
duration / intervalnumber30 / durationMinutes of a visit and between two starts.
hostTimezonestringavailability.timezoneThe zone the hours and slots are written in.
timezone / defaultTimezonestring—The zone shown; the slots move to it. Controlled or not.
onTimezoneChange / timezonePicker(zone) => void / boolean—Lets the person change the zone.
layout"strip" | "calendar""strip"A row of days with their counts, or a month beside the times.
date / defaultDatestring—The day shown. Controlled or not.
days / maxnumber / string7Days in the strip; the last day that can be booked.
nowstring—YYYY-MM-DDTHH:mm in the zone shown: earlier slots are past.
showUnavailable / hour12booleantrue / falseKeep taken slots in the list, struck; AM and PM.
confirmLabel / onConfirmstring / (slot) => void—A primary button under the times.
classNamestring—Extra classes.